Unable to create Apple Passbook signature

I am writing a shell script to automatically generate an Apple Passbook signature file from manifest.json using the p12 certificate. That's what I'm doing:

openssl pkcs12 -passin pass:"mypass" -in "mycert.p12" -clcerts -nokeys -out certificate.pem openssl pkcs12 -passin pass:"mypass" -in "mycert.p12" -nocerts -out key.pem openssl smime -passin pass:"mypass" -binary -sign -signer certificate.pem -inkey key.pem -in manifest.json -out signature -outform DER 

The first two functions work fine. At least both cert.pem and key.pem are created. The signature file is also created, but for some reason it is empty (0 bytes), although manifest.json is not empty, as well as the certificate and key. How can this happen, and how can I fix it?

+4
source share
1 answer

I solved this problem. Apparently, for this I also need a WWDR.pem certificate. Here's how it works:

 openssl pkcs12 -passin pass:"somepass" -in "mycert.p12" -clcerts -nokeys -out certificate.pem openssl pkcs12 -passin pass:"somepass" -in "mycert.p12" -nocerts -out key.pem -passout pass:"somepass" openssl smime -binary -sign -certfile WWDR.pem -signer certificate.pem -inkey key.pem -in manifest.json -out signature -outform DER -passin pass:"somepass" 
+9
source

Source: https://habr.com/ru/post/1436922/


All Articles