PKCS#12 : DerInputStream.getLength() exception
I generate a certificate using the keytool command:

    keytool -genkeypair -alias myRSAKey -keyalg RSA -keysize 1024 -keystore test.p12 -storepass test -storetype pkcs12

Then if I try to load it using java security API, after getting the file as a byte[] :

    KeyStore ks = KeyStore.getInstance("PKCS12");
    try{
       ks.load(new ByteArrayInputStream(data), "test".toCharArray())
    } catch (Exception e){
       ...
    }

I get a DerInputStream.getLength(): lengthTag=127, too big exception.

What is wrong?
PKCS#12 : DerInputStream.getLength() exception
===

I generate a certificate using the keytool command:

    keytool -genkeypair -alias myRSAKey -keyalg RSA -keysize 1024 -keystore test.p12 -storepass test -storetype pkcs12

Then if I try to load it using java security API, after getting the file as a byte[] :

    KeyStore ks = KeyStore.getInstance("PKCS12");
    try{
       ks.load(new ByteArrayInputStream(data), "test".toCharArray())
    } catch (Exception e){
       ...
    }

I get a DerInputStream.getLength(): lengthTag=127, too big exception.

What is wrong?