hengsokchamroeun / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

toDerInputStream rejects tag 66 #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
The error occured when I try to initialize the ssl connection :
1. pushManager.initializeConnection(PushNotification.HOST, 
PushNotification.PORT, PushNotification.CERTIFICATE, PushNotification.PASSWORD, 
SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);

I test also with the classical approach
2. KeyStore ks=KeyStore.getInstance("pkcs12");
3. ks.load(new FileInputStream("C:/key.pem"),"password".toCharArray());

Always I catch the same error :

java.io.IOException: toDerInputStream rejects tag type 66
    at sun.security.util.DerValue.toDerInputStream(Unknown Source)
    at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(Unknown Source)
    at java.security.KeyStore.load(Unknown Source)

I test on Windows (Eclipse) and Debian (jboss server) ...

What to do please ?

Original issue reported on code.google.com by leclere....@gmail.com on 25 Aug 2010 at 9:38

GoogleCodeExporter commented 8 years ago
Have you gone thru the steps on:
http://code.google.com/p/javapns/wiki/GetAPNSCertificate

and:
http://code.google.com/p/javapns/wiki/Tips

my guess is the pem file is bad (unknown Source)

Original comment by idbill.p...@gmail.com on 27 Aug 2010 at 2:49

GoogleCodeExporter commented 8 years ago
I have found what was going wrong : the certificate was in PEM format but in 
JAVA I must read the .p12 file generated by xcode and the keytool chain.

Thanks for your answers.

Original comment by leclere....@gmail.com on 27 Aug 2010 at 7:08

GoogleCodeExporter commented 8 years ago

Original comment by idbill.p...@gmail.com on 30 Aug 2010 at 3:56