KeyStore Problem

Hi,Friends

I want to dynmatically to get keystore.

however,

I always get an exception says:

java.io.IOException: DER input, Integer tag error

what my certificate file is: export from web browser tool->option->Certificates -> other People ->Export

and select DER encoded binary X.509.

Here is my source:

KeyStore keystore = KeyStore.getInstance( "PKCS12" );

keystore.load( new FileInputStream( "D:\\certificate\\509.cer" ), "changeit".toCharArray() );

Thanks in advanced

[551 byte] By [lvguangchuana] at [2007-10-2 22:24:05]
# 1

I am not sure that If I found the issue or not.

only want to post here and hope expert to give me more solution.

my certificate is created by Verisign free trial version.

I found it is not Pcks12 format. it is pcks7.

and I also came cross that some one said the Provider is BouncyCastle.

And I downloaded OpenSSL tool to convert format to pcks12:

>>E:\Program Files\GnuWin32\bin>openssl pkcs12 -export -passout pass:"mcontact" -in pkcs7.p7b -out mcontact.p12

>>Loading 'screen' into random state - done

>>unable to load private key

So I have changed my source like this:

KeyStore keystore = KeyStore.getInstance("PKCS12", Security.getProvider("BC"));

keystore.load(new FileInputStream("D:\\certificate\\new\\mcontact.cer"), "changeit".toCharArray());

However it still pop exception :

java.io.IOException: stream does not represent a PKCS12 key store

Please help me!

lvguangchuana at 2007-7-14 1:41:27 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2
I thought you said the password wasn't 'changeit'?
ejpa at 2007-7-14 1:41:27 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...