SSLHandshakeException when connecting to Apple push notification server

I’m new to this. I generated Certificate Signing Request as in here
. Then I used that certificate file which is in .p12 format to establish a connection to Apple push notification server via java-apns
. Here is the code that I have used.

ApnsService service =
            APNS.newService()
                    .withCert("/home/ApplePush/apple.p12", "abc")
                    .withProductionDestination()
                    .build();
    service.testConnection();

But when I run this code it gives me following esception.

“Exception in thread “main” com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure”.

What is the wrong I have done?

Hi I have had the exact same problem. Like you, I have followed raywenderlinch tutorial and used java-apns library in the backend to communicate with APNS. The certificates thing in the tutorial are focused for php and they are doing something with .pem files which is not needed for java-apns invocation.

I was feeding java-apns with the first .p12 certificate that you create at the beginning of the tutorial. And that was my mistake. What you need to do is generate the .p12 from the certificate generated by apple (aps_developer_identity.cer). Double-click on it and in the keystore manager mac app export as .p12 use some password and try to connect with java-apns using this .p12 and password.

Of course everything related to provisioning portal explained in the ray tutorial must be done correctly.

Thats what has solved my sslHandShakeException. I dont know if you are having the exact same problem but hope it is and this information could help you.

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » SSLHandshakeException when connecting to Apple push notification server

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录