Question

I'm trying to retrieve the certificate and RSA private key from two files I've got: certificate.cer and key.p12

I tried to get them with these commands:

CERTIFICATE

openssl x509 -in certificate.cer -inform der -out certificate.pem

RSA

openssl pkcs12 -in key.p12 -nocerts -nodes -passin pass:123456 | openssl rsa -out key.pem

I try to test it like this:

openssl s_client -connect gateway.sandbox.push.apple.com:2195 
-cert certificate.pem -key key.pem

And I get this error:

140553388308128:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:x509_cmp.c:331:

What am I doing wrong?

Était-ce utile?

La solution

Take a look at this link, explains everything you need to do step by step. This tutorial was the only way I got my push notifications working:

http://blog.serverdensity.com/how-to-build-an-apple-push-notification-provider-server-tutorial/

It explains how push notifications work, and even shows you some php code to send pushes, but I think the Certificates section is what you're looking for.

Good luck!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top