问题描述
我正在编写一个shell脚本,使用p12证书从manifest.json中自动生成一个Apple Passbook签名文件。这是我做的:
I am writing a shell script to automatically generate an Apple Passbook signature file from manifest.json using p12 certificate. Here is what I do:
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
前两个函数工作正常。至少同时创建certificate.pem和key.pem。签名文件也被创建,但由于某种原因它是空的(0字节),虽然manifest.json不是空的,以及证书和密钥。
The first two functions work fine. At least both certificate.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 certificate and key. How can this happen, and how can I fix it?
推荐答案
我已经解决了这个问题。显然,我也需要WWDR.pem证书来做到这一点。这是它的工作原理:
I have solved this problem. Apparently, I also need WWDR.pem certificate to do this. This is how it worked:
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"
这篇关于无法生成Apple Passbook签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!