aspose file tools*
The moose likes Beginning Java and the fly likes PKCS12 - Different resutls on JDK1.4 and JDK 1.5 and above  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "PKCS12 - Different resutls on JDK1.4 and JDK 1.5 and above  " Watch "PKCS12 - Different resutls on JDK1.4 and JDK 1.5 and above  " New topic
Author

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

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

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

Joined: Nov 07, 2000
Posts: 242
Give it a try with Bouncy Castle pkcs12 KeyStore implementation. It might solve the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PKCS12 - Different resutls on JDK1.4 and JDK 1.5 and above