APNS证书.p12转.pem

admin 1月前 24


aps_development.cer(苹果官网制作)

apns-dev-cert.p12(从钥匙串证书Apple Push Services导出)

apns-dev-key.p12(从钥匙串证书下拉的秘钥导出)

三个证书搞好之后,终端CD到以上证书所在文件夹,

openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12

 

openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12

 

cat apns-dev-cert.pem apns-dev-key.pem > apns-dev.pem

连续执行以上三行代码,期间需要输入密码,和pass phrase,

注意:密码是导出p12时的密码,pass phrase位数尽量多,位数太少制作的key.pem无法使用。6位即可

验证证书:

bogon:~ lcm$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev.pemEnter pass phrase for apns-dev.pem:

或者:bogon:~ lcm$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev-cert.pem -key apns-dev-key-noenc.pem -debug -showcerts -CAfile “apns-dev.pem”

Error opening client certificate private key file apns-dev-key-noenc.pem

140736230040456:error:02001002:system library:fopen:No such file or directory:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22/libressl/crypto/bio/bss_file.c:255:fopen('apns-dev-key-noenc.pem', 'r')

140736230040456:error:20074002:BIO routines:FILE_CTRL:system lib:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22/libressl/crypto/bio/bss_file.c:257:

unable to load client certificate private key file

以上问题就是pass phrase位数太少引起。


最新回复 (0)
返回
发新帖