Comments (10)
Hi,
I had the same issue.
The problem is apparently not your client certificate, but that you can't
validate
Apple's server certificate.
I got it to work by modifying the way the SSLSocket is created in
SSLConnectionHelper.getSSLSocket().
When initializing the SSLContext, a trustmanager needs to be provided that
contains
Apple's server certificate. Note that this trustmanager can only be set when
using
the feedback service, using it when pushing notifications will result in an
error.
Note that I have no idea if this is the best way of doing this, but hey, it
works.
First, you need to get a hold of either Apple's server certificate or the
certificate
of its Certification Authority:
This second option is the easiest, just download it from
http://aia.entrust.net/2048-l1b.cer
Then, use keytool (comes with your Java JDK) to create a keystore and add the
certificate to it. I used the same password as for my client certificate, that
will
make it easier later on.
Finally, modify SSLConnectionHelper.getSSLSocket():
* add a parameter to the method signature:
public SSLSocket getSSLSocket(boolean loadServerCertificate) throws ...
* Where this method is called in FeedbackServiceManager.getDevices() pass 'true', on
the other 2 invocations pass 'false'
* add the following code just above where the SSLContext is created in
SSLConnectionHelper.getSSLSocket() (replace the path to your keystore)
TrustManager[] trustManagers = null;
if (loadServerCertificate) {
KeyStore ks2 = KeyStore.getInstance("JKS");
ks2.load(new FileInputStream(new File("/path/to/my/server/certificate/keystore")),
this.keyStorePass.toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(ALGORITHM);
tmf.init(ks2);
trustManagers = tmf.getTrustManagers();
}
* Finally, add the trustmanager as a parameter to the SSLContext initialization:
sslc.init(kmf.getKeyManagers(), trustManagers, null);
This worked for me, let me know how it goes.
Original comment by [email protected]
on 15 Aug 2009 at 4:03
from javapns.
Hello,
Can you provide a sample project of what you've done ? It will be very helpfull
Thanks for your help anyway
Original comment by [email protected]
on 9 Sep 2009 at 7:40
from javapns.
Ok don't read my previous message, this is working like a charm.
Original comment by [email protected]
on 10 Sep 2009 at 2:03
from javapns.
I've tried the changes, and am looking to integrate them into the code... but
I'm getting no data.
How long does it take for the feedback service (apple) to start working? Does
it only work once the iPhone App is
published?
Bill
Original comment by [email protected]
on 24 Sep 2009 at 12:06
from javapns.
I am facing the same issue as Bill.
Could you please confirm how long does it takes until the feedback service
generates
data?
thaks
Original comment by [email protected]
on 20 Oct 2009 at 10:19
from javapns.
Hello
It's instantaneous.
I talk to the feedback service each time after sending notifications to my
customer and
iPhone who don't receive the notification appear in the list immediately.
Note that feedback service seems not to work in test environnement.
Original comment by [email protected]
on 20 Oct 2009 at 11:17
from javapns.
Hello Julien,
Thanks for your feedback. You are right. It doesnt work in the test environment
and I
was doing my tests there.
Original comment by [email protected]
on 26 Oct 2009 at 2:51
from javapns.
Big thanks to IwijnX for posting his solution
Worked fine for me, once I worked out how to do the keytool thing :)
Original comment by [email protected]
on 3 Dec 2009 at 5:39
from javapns.
Can someone explain more clearly the solution
Original comment by [email protected]
on 14 Dec 2009 at 4:14
from javapns.
The source code has been updated with my Feedback Service changes. You might
also notice that the ssl cert
thing is much more transparent now.
Original comment by [email protected]
on 19 Feb 2010 at 9:28
- Changed state: Fixed
from javapns.
Related Issues (20)
- String index out of bounds in javapns.notification.PushedNotification.toString line 251 HOT 3
- invalid token error HOT 5
- encountered "KeystoreException (Keystore contains too many certificates)" HOT 3
- Apple dropping support for SSL 3.0 on push notification servers, requiring TLS by October 29th HOT 3
- JavaAPN can't work on Windows but Mac OS is fine, why???? HOT 3
- Feature request: configurable or parameterized time waiting on socket HOT 4
- Feature request: configurable or parameterized retry policy HOT 3
- Creating certificates step-by-step link broken HOT 1
- thread terminated after reached max msg send HOT 3
- Exception reporting not working for multiple payloads
- Responses not read? HOT 1
- Javapns Communication exception:Connection refused to ConnectionToAppleServer
- support for title-loc-key (ios 8.2)
- Unable to connect APNS - CommunicationException - java.net.ConnectionException : Communication Timed Out HOT 2
- Duplicate notifications being sent out at high rate
- Add content-available to PushNotificationPayload
- Do you support VoIP push notifications?
- javaapns does not supports log4j 2
- Exception java.net.SocketException
- Javapns Notifications SSL Exceptions and Closed Sockets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javapns.