简体   繁体   English

将推送通知证书导出为 P12

[英]Export push notification certificate as P12

Normally, I can export the certificate from the keychain that I download from the apple member center as a p12 file.通常,我可以将我从苹果会员中心下载的钥匙串中的证书导出为p12文件。 However, it seems that Apple may have changed something?!不过,苹果好像改了什么东西?!

I require it as a p12 to import it into Amazon's SNS service.我需要它作为 p12 以将其导入亚马逊的 SNS 服务。 I have tried converting to PEM files but it's producing an error on the console.我曾尝试转换为 PEM 文件,但它在控制台上产生错误。

在此处输入图像描述

您无法导出到 .p12,因为您的机器上没有安装私钥(如果安装了,您将在证书旁边有一个“扩展”箭头,就像您的 iPhone 分发证书一样。)您将需要在导出之前从生成证书的机器获取私钥。

The solution I have found has been posted here: https://stackoverflow.com/a/19502944/1198404我找到的解决方案已发布在这里: https : //stackoverflow.com/a/19502944/1198404

I copy and paste the answer: Turns out all you have to do is select "My Certificates" on the left panel and it enables the .p12 option.我复制并粘贴了答案:原来您所要做的就是在左侧面板上选择“我的证书”并启用 .p12 选项。

You don't have the private key.你没有私钥。

So the solution is you have to revoke the previous certificate and create a new APNS profile again.因此,解决方案是您必须撤销之前的证书并再次创建新的 APNS 配置文件。

If the accepted answer doesn't apply to you (eg, because you created the CSR from the same Mac, and should have the private key on this Mac), here's one more possibility:如果接受的答案不适用于您(例如,因为您从同一台 Mac 创建了 CSR,并且应该在这台 Mac 上拥有私钥),那么还有一种可能性:

When you happen to have selected the wrong keychain (like if you accidentally had single clicked on the System keychain rather than Login keychain), you may run into the same problem.当您碰巧选择了错误的钥匙串时(例如,如果您不小心单击了系统钥匙串而不是登录钥匙串),您可能会遇到同样的问题。 If the cert signing request came from that machine, it would associate the private key with the Login keychain (at least, that seems to be the default).如果证书签名请求来自那台机器,它会将私钥与登录钥匙串相关联(至少,这似乎是默认设置)。 So if you somehow then downloaded and imported the certificate into another keychain like the System keychain (or iCloud keychain, as some comments have mentioned), Keychain Access would not find the matching private key and would not put the cert under "My certificates", and so it cannot export a p12.因此,如果您以某种方式下载证书并将其导入另一个钥匙串,如系统钥匙串(或 iCloud 钥匙串,如某些评论所述),钥匙串访问将找不到匹配的私钥并且不会将证书放在“我的证书”下,所以它不能导出 p12。 It would be similar to the case of importing to the keychain on a different Mac.这类似于导入到不同 Mac 上的钥匙串的情况。

Make sure the import is into the keychain associated with the private key.确保导入到与私钥关联的钥匙串中。 Often this would be the Login keychain.这通常是登录钥匙串。

You can export from Cert just like below.您可以像下面一样从证书中导出。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM