Created
February 5, 2015 20:21
-
-
Save blar/1b666adf6816b29dc8fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pkcs12file = new SplFileInfo(__DIR__.'/passbook.p12'); | |
if(!file_exists($pkcs12file)) { | |
$pkcs12 = new Pkcs12(); | |
$file = new SplFileInfo(__DIR__.'/passbook_certificate.pem'); | |
$certificate = new Certificate($file); | |
$pkcs12->setCertificate($certificate); | |
$file = new SplFileInfo(__DIR__.'/passbook_key.pem'); | |
$privateKey = new PrivateKey($file); | |
$pkcs12->setPrivateKey($privateKey); | |
$file = new SplFileInfo(__DIR__.'/AppleWWDRCA.pem'); | |
$certificate = new Certificate($file); | |
$pkcs12->setChain($certificate); | |
$pkcs12->exportToFile($pkcs12file); | |
} | |
$pkcs12 = new Pkcs12($pkcs12file); | |
$manifest = new SplFileInfo(__DIR__.'/manifest.json'); | |
$signature = Pkcs7::signWithPkcs12($manifest, $pkcs12, PKCS7_BINARY | PKCS7_DETACHED); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment