简体   繁体   English

Apple Push Notifications,如何正确导出我的证书?

[英]Apple Push Notifications, how do I properly export my cert?

I can't seem to figure out how to properly export my cert for use in my iOS app with push notifications.我似乎无法弄清楚如何正确导出我的证书以在我的 iOS 应用程序中使用推送通知。 I'm using the following cert, downloaded from the Certificates section of the iOS Provisioning Portal .我正在使用以下证书,从iOS Provisioning Portal证书部分下载。

在此处输入图像描述

I'm then following one of the many tutorials I've found all over the web that are all different by the way, to get my cert into a .pem format for use in ruby-apns .然后,我将遵循我在 web 中找到的众多教程之一,顺便说一下,这些教程都不同,以将我的证书转换为.pem格式以用于ruby-apns

First I export it from the Keychain:首先我从钥匙串中导出它:

在此处输入图像描述

After I give it a name and a password I perform the following commands in the terminal*:在我给它一个名称和密码后,我在终端中执行以下命令*:

openssl pkcs12 -in cert.p12 -out apple_push_notification_dev.pem -nodes -clcerts

*note: this isn't the only way I've tried this, just the latest, I have also tried via the instructions at the following urls: *注意:这不是我尝试过的唯一方法,只是最新的方法,我还通过以下网址的说明进行了尝试:

Not a single one of these solutions work.这些解决方案没有一个有效。 I'm sitting here looking at the following error from the console when I try to use ruby-apns:当我尝试使用 ruby-apns 时,我正坐在这里从控制台查看以下错误:

read finished A: sslv3 alert certificate unknown (OpenSSL::SSL::SSLError)

And essentially every other server solution I've found has told me my certificate is incorrect or that there's a problem with it as well.基本上我发现的所有其他服务器解决方案都告诉我我的证书不正确或者它也有问题。

Am I doing this wrong?我做错了吗?

=============================== ================================

Overnight Courtesy Bump Stealth Edit隔夜礼貌碰撞隐身编辑

So I beat my head against the wall last night, and actually came across Apple's own instructions for doing this.所以昨晚我把头撞在墙上,实际上是看到了苹果自己的说明。 It's almost the exact same, and I tried it to the same tune.几乎一模一样,我也尝试过同样的曲调。 Nevertheless, here is the latest attempt from this link :不过,这是此链接的最新尝试:

openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes

(1) First you need to set the configuration for your app ID to enable push notification service. (1) 首先,您需要为您的应用 ID 设置配置以启用推送通知服务。 You can check in the image.您可以检查图像。在此处输入图像描述

(2) Then You can install the certificate and intall in your keychain in your machine. (2)然后您可以在您的机器中的钥匙串中安装证书并安装。在此处输入图像描述

(3) Here you are exporting two files. (3) 这里你要导出两个文件。 Instead of that you just need to export the private key as shown in the screenshot.取而代之的是,您只需要导出私钥,如屏幕截图所示。在此处输入图像描述

(4) Now you can export the private key and store with any name you want in.p12 format as shown in the screenshot below. (4) 现在您可以导出私钥并以您想要的任何名称存储在.p12 格式中,如下面的屏幕截图所示。在此处输入图像描述

(5) Then follows all other steps as you know very well like you mentioned above. (5) 然后按照您上面提到的所有其他步骤进行操作。

openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes

Please let me know if you still have any question or if you are not able to solve then let me know.如果您仍有任何问题或无法解决,请告诉我。

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

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