f



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

I'm trying to import a PKCS12 certificate into a Keystore:

KeyStore keyStore = KeyStore.getInstance( "PKCS12" );
keyStore.load( new FileInputStream( "/tmp/client.p12" ), "changeit".toCharArray() );

This code yields the exception below:

Exception in thread "main" java.io.IOException: DER input, Integer tag error
	at sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
	at com.sun.net.ssl.internal.ssl.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1195)
	at java.security.KeyStore.load(KeyStore.java:1150)

$ java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
0
jason109 (62)
12/5/2004 2:55:09 PM
comp.lang.java.security 1502 articles. 0 followers. Post Follow

1 Replies
10276 Views

Similar Articles

[PageSpeed] 38

I'm posting an answer to my own question. The problem was that the file
was not in .p12 format.

By the way, the openssl command is handy for converting certificates
from one format to another.

Jason Friedman wrote:
> I'm trying to import a PKCS12 certificate into a Keystore:
>
> KeyStore keyStore = KeyStore.getInstance( "PKCS12" );
> keyStore.load( new FileInputStream( "/tmp/client.p12" ),
"changeit".toCharArray() );
>
> This code yields the exception below:
>
> Exception in thread "main" java.io.IOException: DER input, Integer
tag error
> 	at
sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
> 	at
com.sun.net.ssl.internal.ssl.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1195)
> 	at java.security.KeyStore.load(KeyStore.java:1150)
>
> $ java -version
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

0
jason
12/7/2004 6:42:29 AM
Reply:

Web resources about - java.io.IOException: DER input, Integer tag error - comp.lang.java.security

Resources last updated: 3/8/2016 4:53:39 AM