I'm trying to test push notifications for my app, but can't connect to the apple sandbox with my certificate and private key. I'm following this tutorial.
I set up a new certificate and app id per the tutorial, set up a private key, and generated the .pem files for the certificate and the private key:
openssl x509 -in aps_developer_identity.cer -inform der -out PushTestCert.pem
openssl pkcs12 -nocerts -out PushTestKey.pem -in PushTestKey.p12
For the private key, it asks me to enter the original password the key, as well as a new one. I used the same password.
Then I test the connection to apple and am prompted for my password, and I enter the new password for the key .pem file, which is the same as the old password:
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:
Is there something I'm missing? On the iOS provisioning portal my app id says it is enabled for development (push). I've tried re-downloading the openssl certificate, no cigar.
Best Answer
Just to follow up, the reason this is probably happening is that you did not use the new public key to generate a push notification certificate for your app in developer.apple.com. So it can't match, because you private key does not match the public key used to generate the push notification cert