Cannot send push notifications using Javapns/Javaapns SSL handshake failure

I am a new iOS developer and I had the same issue before.

I finally found that the problem was due to the p12 certificate.
We should not use the private key p12 file, instead we should generate a p12 from your private key and the cert download from Apple.

Please execute the following OpenSSL command to get the correct p12 file:

developer_identity.cer <= download from Apple
mykey.p12 <= Your private key

openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM
openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem
openssl pkcs12 -export -inkey mykey.pem -in developer_identity.pem -out iphone_dev.p12

After that, you should use iphone_dev.p12 to communicate with apple server.

Leave a Comment