Cannot send push notifications using Javapns/Javaapns SSL handshake failure

前端 未结 2 806
北恋
北恋 2020-12-01 02:30

I have an issue with push notifications. I have a p.12 certificate that was created by a team member and I have the device token for the device to be pushed to. I am using t

相关标签:
2条回答
  • 2020-12-01 02:47

    Sunny's answer is a great one, but unfortunately it didn't work for me.

    I got it working by exporting the certificate/private key pair from the keychain. The trick is that the selection sequence matters! The certificate has to be selected first, followed by the private key.

    Here is how it works:

    1. Import the certificate downloaded from Apple into the keychains
    2. Expand so that the private key is visible
    3. Select the certificate followed by the private key
    4. Right click and choose [Export 2 items...]
    0 讨论(0)
  • 2020-12-01 02:53

    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.

    0 讨论(0)
提交回复
热议问题