Code Monkey home page Code Monkey logo

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
Can someone explain more clearly the solution

Original comment by [email protected] on 14 Dec 2009 at 4:14

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.