苹果推送通知错误设置私钥 [英] Apple Push Notification error setting private key

查看:35
本文介绍了苹果推送通知错误设置私钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力为我的应用程序正确设置推送通知证书.该应用程序已经在商店中,所以我不能像其他人遇到此问题的解决方案那样重新开始"生成文件!

I have been fighting to get the push notification certificates setup correctly for my app. The app is already in the store, so I can't just 'start over' generating files as has been the solution for others having this problem!

我以这篇文章为例来创建证书:http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1#comments.当我开始测试我生成的内容时,我得到:

I have used this article as an example to create the certificates: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1#comments. When I get to the point of testing what I have generated I get:

openssl s_client -connect gateway.sandbox.push.apple.com:2195 -certPushTestCert.pem -key PushTestKey.pem
输入密码短语PushTestKey.pem:
错误设置私钥
4368:错误:0B080074:x509证书例程:X509_check_private_key:密钥值不匹配:/SourceCache/OpenSSL098/OpenSSL098-35.1/src/crypto/x509/x509_cmp.c:406:

openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushTestCert.pem -key PushTestKey.pem
Enter pass phrase for PushTestKey.pem:
error setting private key
4368:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:/SourceCache/OpenSSL098/OpenSSL098-35.1/src/crypto/x509/x509_cmp.c:406:

该示例显示了 Keychain Access 的 Keys 部分中的应用程序.我的应用程序在那里,但在私钥下它有一个证书(我的 iPhone 开发者证书).我需要将这两个项目都导出到我的 p12 中,还是只需要导出私钥?

The example shows the app in the Keys section of Keychain Access. My app is there, but under the private key it has a certificate (my iPhone Developer certificate). Do I need to export both items into my p12, or just the private key?

我已经尝试下载 aps_development.cer 并将其转换为 pem 并从 Keychain Access 创建证书 pem,但在任何一种情况下都没有成功.

I've tried both downloading the aps_development.cer and turning it into a pem and creating the cert pem from Keychain Access, and not having success in either case.

其他帖子提示应用p12有问题,但是我怎么才能看到私钥是什么以及为什么不匹配???

Other posts have suggested that the app p12 is wrong, but how can I see what the private key is and why there is a mismatch???

推荐答案

您应该将 apns 证书作为单独的 cert/key pem 文件提供.并且您需要从您的密钥 pem 中删除密码.

You should provide your apns certificate as separated cert/key pem files. and you need to remove the password from your key pem.

将 pem 文件与 p12 分开

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

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

从 pem 文件中删除密码

openssl rsa -in key.pem -out key-noenc.pem

这篇关于苹果推送通知错误设置私钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆