aps_developer_identity.cer到p12而不必从Key Chain导出?

wit*_*kay 21 openssl pkcs#12 apple-push-notifications

我有一个棚子负载从iPhone开发者门户网站导出"aps_developer_identity.cer"证书.它们都是使用相同的证书签名请求和(因此)相同的私钥创建的.如果我只从Apple Key Chain导出私钥,那么可以使用私钥和'aps_developer_identity.cer'并使用openssl创建我可以在我的(Windows)服务器上使用的合并的p12/pkcs#12证书.

为了清楚起见,我知道如何通过将私钥和证书一起导出来从密钥链中获取合并的p12,但是如果可以的话,我想删除所有额外的鼠标点击和输入.

wit*_*kay 38

我设法解决了这个问题,只需要在shell脚本中进行包装就可以了.我假设您已下载并重命名了'apple_developer_identity.cer'证书,此处我使用'test.cer',并且您还从钥匙串中导出了您的开发人员密钥,在下面的示例中名为'private_dev_key.p12'.

#convert *.cer (der format) to pem
openssl x509 -in test.cer -inform DER -out test.pem -outform PEM

#convert p12 private key to pem (requires the input of a minimum 4 char password)
openssl pkcs12 -nocerts -out private_dev_key.pem -in private_dev_key.p12

# if you want remove password from the private key
openssl rsa -out private_key_noenc.pem -in private_key.pem

#take the certificate and the key (with or without password) and create a PKCS#12 format file
openssl pkcs12 -export -in test.pem -inkey private_key_noenc.pem -certfile _CertificateSigningRequest.certSigningRequest  -name "test" -out test.p12
Run Code Online (Sandbox Code Playgroud)

注意:如果您认为这有点长,以实现只需点击几下鼠标和键入文件名即可完成的操作,那么请考虑您要为通知启用20个应用程序的情况.每个应用程序都有开发和生产证书,分别在4个月和12个月后到期.这是一项非常无聊且容易出错的工作......

  • 对于最后一个命令我得到"无法加载证书" (8认同)
  • _CertificateSigningRequest.certSigningRequest问题绝对不清楚,需要加以解释.该链接没有详细说明.我知道如何使用钥匙串生成一个,但是当我在上面的脚本中使用它时,我不断收到错误"没有证书匹配私钥"...为什么?究竟是什么certSigningRequest在上面提到? (3认同)