Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PKCS12 - Different resutls on JDK1.4 and JDK 1.5 and above

 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, i've recieved a PKCS12 file which contains a certificate and private key that i am supposed to extract. As im new to certificates and the whole PKI infrastructure i attempted to write a small program to try and view the contents of the PKCS#12 file.

A password is required to retrieve the certificate and the private key from the pkcs12 file. A password was provided to me and the instructions state that the password is the MD5 hash of the password that was provided to me.

I am having two weid prolems with this implementation. If i run this class on a JDK1.5 VM the password is rejected with the following error.



I am not sure why it is insisting that the password should be ASCII. Does anyone know why this is the case?

If i run the same class on JDK 1.4, i can open the PKCS12 file so the password is accepted. as shown below



The exception in 1.4 is to do with this line i think



I havent found out the resolution to the above problem but im a bit worried on teh error if i ran it on 1.5. As i dont have control of the format of the password, i cant just change it to be an ASCII password. Is there a way i can get it to accept a non-ascii password?

Here are the classes i used to test the above.




Any help will be greatly appreciated.

[ July 06, 2008: Message edited by: O. Ziggy ]

[ July 06, 2008: Message edited by: O. Ziggy ]
[ July 06, 2008: Message edited by: O. Ziggy ]
 
Santhosh Kumar
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Give it a try with Bouncy Castle pkcs12 KeyStore implementation. It might solve the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic