Apple Push Notification错误设置私钥 [英] Apple Push Notification error setting private key

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

问题描述

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

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!

我已以本文为例创建证书:

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-连接gateway.sandbox.push.apple.com:2195 -cert PushTestCert.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:

该示例在钥匙串访问"的钥匙"部分显示了该应用程序.我的应用程序在那里,但是在私钥下它具有证书(我的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文件提供.并且您需要从密钥库中删除密码.

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

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

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