captain-fox / PyWallet

A Python Module for Signing and verifying Apple Wallet Passbooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyWallet

A Python Module for signing and verifying Apple Wallet Passbooks

Getting the certificates

  1. Get a Pass Type Id
  • Visit the iOS Provisioning Portal -> Pass Type IDs -> New Pass Type ID
  • Select pass type id -> Configure (Follow steps and download generated pass.cer file)
  • Import downloaded certificate into Keychain Access on your Mac.
  • Export the certificate from Keychain Access into a ".p12" file (In "Usage" section below this file is referenced as "Key.p12")
  1. Get Apple WWDR Certificate
	$ openssl x509 -inform der -in AppleWWDRCA.cer -out AppleWWDRCA.pem
  1. Get PassKit support materials and sample Pass data from Apple

Installing required libraries

Mac:

    $ brew install openssl
    $ brew upgrade openssl    

Ubuntu/Linux:

    $ apt-get install openssl
    $ apt-get upgrade openssl    

Using PyWallet tool:

from PKPass import PKPass
import CertSign

if __name__ == "__main__":
    
    CertSign.initializeOpenSSL()
    
    pkpass = PKPass(pass_directory_path="./Passes/SamplePass.pass")
    pkpass.sign(key="./Certs/Key.p12", cert="./Certs/AppleWWDR.pem", password="")
    pkpass.compress("./Passes/SamplePass.pkpass")
	
    CertSign.freeOpenSSL()

About

A Python Module for Signing and verifying Apple Wallet Passbooks

License:MIT License


Languages

Language:Python 100.0%