Apple Push Notification with Java

Hi,


I am sending Apple Push Notifications (APN) from a program written in Java using the library https://github.com/notnoop/java-apns

As long as I use Java 6 runtimes there is no problem. The messages are sent. But if I change
to Java 8 I always get a SSL handshake error. After a little research on Google I found that some ciphers
are no longer enabled and by default TLSv1.2 is the SSL protocol in Java 8. https://java.com/en/download/faq/release_changes.xml


So I tried to switch to TLSv1.0 and enabled all the ciphers possible in Java 8. But still I got the SSL handshake error.

So my questions are:

- Did anybody have the same issue and found a solution?
- What are the allowed protocols/ciphers to connect to gateway.push.apple.com?


Michael

Replies

Problem solved?

Yes I solved the problem. The problem was the exported keystore (in PKCS12 format) contained the private key as well as the production certificate and the development certificate for push notifications. Java can use keystores in the PKCS12 format. But Java 6 and Java 8 did not read-in the keystore the same way. It looks like Java 6 read in the production certificate for the private key and Java 8 read in the development certificate.


My solution was to create a keystore file in the JKS format containing only the private key and the production certificate.

  • Dear @szediwy , thanks any reference for this? Guess for one Apple ID (for example my own), such push notification from MacBook to iPhone is free, correct?

Add a Comment