Closed GoogleCodeExporter closed 8 years ago
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 Iwi...@gmail.com
on 15 Aug 2009 at 4:03
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 julien.r...@gmail.com
on 9 Sep 2009 at 7:40
Ok don't read my previous message, this is working like a charm.
Original comment by julien.r...@gmail.com
on 10 Sep 2009 at 2:03
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 idbill.p...@gmail.com
on 24 Sep 2009 at 12:06
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 fernando...@gmail.com
on 20 Oct 2009 at 10:19
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 julien.r...@gmail.com
on 20 Oct 2009 at 11:17
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 fernando...@gmail.com
on 26 Oct 2009 at 2:51
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 mattkr...@gmail.com
on 3 Dec 2009 at 5:39
Can someone explain more clearly the solution
Original comment by kalashni...@gmail.com
on 14 Dec 2009 at 4:14
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 idbill.p...@gmail.com
on 19 Feb 2010 at 9:28
Original issue reported on code.google.com by
julien.r...@gmail.com
on 14 Aug 2009 at 2:16