From 1611e73c9e6db0a97bf99680e16a8d6eac017fe5 Mon Sep 17 00:00:00 2001 From: Erik Pettersson Date: Sat, 22 Sep 2012 21:29:48 +0200 Subject: [PATCH] Added setter for WWDR Intermediate certificate with updated example and readme. --- PKPass.php | 11 +++++++++++ example.php | 8 ++++---- readme.md | 5 +++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/PKPass.php b/PKPass.php index 899d9f1..c400e49 100644 --- a/PKPass.php +++ b/PKPass.php @@ -116,6 +116,16 @@ public function setCertificatePassword($p) { return true; } + /* + * Sets the path to the WWDR Intermediate certificate + * Parameter: string, path to certificate + * Return: boolean, always true + */ + public function setWWDRcertPath($path) { + $this->WWDRcertPath = $path; + return true; + } + /* * Decodes JSON and saves it to a variable * Parameter: json-string @@ -129,6 +139,7 @@ public function setJSON($JSON) { $this->sError = 'This is not a JSON string.'; return false; } + /* * Adds file to the file array * Parameter: string, path to file diff --git a/example.php b/example.php index f16b70d..ad828c7 100644 --- a/example.php +++ b/example.php @@ -3,8 +3,9 @@ $pass = new PKPass(); -$pass->setCertificate('../Certificate.p12'); // Set the path to your Pass Certificate (.p12 file) -$pass->setCertificatePassword('test123'); // Set password for certificate +$pass->setCertificate('../Certificate.p12'); // Set the path to your Pass Certificate (.p12 file) +$pass->setCertificatePassword('test123'); // Set password for certificate +$pass->setWWDRcertPath('../AppleWWDRCA.pem'); // Set the path to your WWDR Intermediate certificate (.pem file) $pass->setJSON('{ "passTypeIdentifier": "pass.com.apple.test", @@ -62,5 +63,4 @@ $pass->addFile('images/icon@2x.png'); $pass->addFile('images/logo.png'); -$pass->create(true); // Create and output the PKPass -?> \ No newline at end of file +$pass->create(true); // Create and output the PKPass \ No newline at end of file diff --git a/readme.md b/readme.md index 194821d..81659be 100644 --- a/readme.md +++ b/readme.md @@ -24,9 +24,10 @@ Please note that iOS 6 and Passbook are still in beta, which means that the API 6. Choose a password and export the file to a folder ### Getting the example.php sample to work -1. Request the Pass certificate and upload it to your server +1. Request the Pass certificate (`.p12`) and upload it to your server 2. Set the correct path and password on [line 6 and 7](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L6) -3. Change the `passTypeIdentifier` and `teamIndentifier` to the correct values, which can be found on the [iOS Provisioning portal](https://developer.apple.com/ios/manage/passtypeids/ios/manage) after clicking on 'Configure' next to the Pass ID, on line [10](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L10) and [14](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L14) +3. Download and import your [WWDR Intermediate certificate](https://developer.apple.com/certificationauthority/AppleWWDRCA.cer) to Keychain, export as `.pem` and set the correct path on [line 8](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L8) +4. Change the `passTypeIdentifier` and `teamIndentifier` to the correct values, which can be found on the [iOS Provisioning portal](https://developer.apple.com/ios/manage/passtypeids/ios/manage) after clicking on 'Configure' next to the Pass ID, on line [11](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L10) and [15](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L14) After completing these steps, you should be ready to go. Upload all the files to your server and navigate to the address of the example.php file on your iPhone.