JavaPNS and JRE7
By type of activity, I was faced with the need to send push notifications to apple devices. The JavaPNS 2.2 library was found , a certificate was prepared for the Developer version, a service was written that sends push notifications, everything started, everything turned off, push notifications are sent - in general, complete happiness. But now the release day has come, the Production certificate has been prepared again and exported together with the private key in p12, everything is installed on the server ... iii ... as you probably guessed, nothing worked :). Judging by the logs, push is sent, but nothing comes to the device.
First, check out the JavaPNS documentation and see a not-so-encouraging entry:
Googling gives roughly the same results and tips. But 1 single mention of the problem was found:
The bottom line is, for some reason, oracle excluded the Entrust root certificate from jre7.
Therefore, we need to tell jre about this certification authority. Option 2, put it where it should be / usr / lib / jre7 / ... (this is not our way, because the evil admin does not give root rights, but doesn’t want to install anything) and the second option is to simply include it in a container with certificate and private key. Which we will do.
1. Download certificate
2. Import it into KeyChain and get something like the following
3. Select 3 entities: certificate, private key and root certificate Entrust
4. Right-click Export 3 items and save the p12 container (remember to enter the password)
5. Next, connect to p12 with gateway.push .apple.com and forwardspam notify users :)
First, check out the JavaPNS documentation and see a not-so-encouraging entry:
* ABOUT JAVA 7 *:
Some users have reported problems creating SSL connections while using Java 7 (in general, not just with JavaPNS).
Until this issue is completely resolved, you should try to run JavaPNS with Java 5 or 6 if you experience
SSL-related connection issues.
Googling gives roughly the same results and tips. But 1 single mention of the problem was found:
Java 7 (JDK 1.7) doesn't know about the Entrust Root CA. Import your APNS cert, key, AND the Entrust CA Root certificate into a p12 file. Point the code at that file and it will work.
The bottom line is, for some reason, oracle excluded the Entrust root certificate from jre7.
Therefore, we need to tell jre about this certification authority. Option 2, put it where it should be / usr / lib / jre7 / ... (this is not our way, because the evil admin does not give root rights, but doesn’t want to install anything) and the second option is to simply include it in a container with certificate and private key. Which we will do.
1. Download certificate
curl https://www.entrust.net/downloads/binary/entrust_ssl_ca.cer > entrust_ssl_ca.cer
2. Import it into KeyChain and get something like the following
3. Select 3 entities: certificate, private key and root certificate Entrust
4. Right-click Export 3 items and save the p12 container (remember to enter the password)
5. Next, connect to p12 with gateway.push .apple.com and forward