iphone - 苹果推送通知连接问题 - 键值不匹配检查私钥消息

标签 iphone ios apple-push-notifications

我正在尝试为我的应用程序测试推送通知,但无法使用我的证书和私钥连接到 Apple 沙箱。我正在关注 this tutorial .

我根据教程设置了一个新的证书和应用程序 ID,设置了一个私钥,并为证书和私钥生成了 .pem 文件:

openssl x509 -in aps_developer_identity.cer -inform der -out PushTestCert.pem
openssl pkcs12 -nocerts -out PushTestKey.pem -in PushTestKey.p12 

对于私钥,它要求我输入原始密码和新密码。我使用了相同的密码。

然后我测试与 apple 的连接并提示我输入密码,我输入 key .pem 文件的新密码,它与旧密码相同:

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
59244:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:/SourceCache/OpenSSL098/OpenSSL098-35.1/src/crypto/x509/x509_cmp.c:406:

有什么我想念的吗?在 iOS 配置门户上,我的应用程序 ID 表示它已启用开发(推送)。我试过重新下载 openssl 证书,没有雪茄。

最佳答案

跟进一下,发生这种情况的原因可能是您没有使用新的公钥在 developer.apple.com 中为您的应用程序生成推送通知证书。所以它无法匹配,因为您的私钥与用于生成推送通知证书的公钥不匹配

关于iphone - 苹果推送通知连接问题 - 键值不匹配检查私钥消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7707570/

相关文章:

ios - CoreData managedObjectContext save 违反了 Z_PK 的 UNIQUE 约束

ios - 在代码中使用 NSManagedObject 模型

android - 应用程序关闭或手机关闭时,是否可以在 Android/iOS 应用程序上接收 Pusher 消息

ios - 即使 iPhone 未连接到 Internet 也收到设备 token

ios - 为什么要在 didFinishLaunchingWithOptions 中使用 UIApplicationLaunchOptionsRemoteNotificationKey?

ios - 在 SwiftUI 中获取文本的宽度

iphone - UITableViewController、UITableView 和 UIPopoverController 的内存管理

ios - NSCoding NSKeyedUnarchiver unarchiveObjectWithFile : returning null

iphone - 是否值得将核心数据用于 iphone 上的一个简单的 sqlite 应用程序,只有一个表,没有关系或复杂的子表/ View ?

iphone - 从 UIViewController 推送 Tabbarcontroller