Lftbrito
Lftbrito

Reputation: 73

Erro after build when trying to get .p12 SSL certfile DerInputStream.getLength(): lengthTag=111, too big

Im getting the erro DerInputStream.getLength(): lengthTag=111, too big. only after I build my project. If I run it on the IDE everything goes normal, but after a "mvn clean package" and try to run it, I get this error.

How Im trying to get the KeyStore.

        InputStream keyInput = classLoader.getResourceAsStream("certfile/cert.p12");

        KeyStore keyStore = KeyStore.getInstance("PKCS12");
        keyStore.load(keyInput, p12password.toCharArray());
        keyInput.close();

How i built my cert

openssl pkcs12 -export -out cert.p12 -in cert_crt.pem -inkey cert_key.pem -passout pass: 123456

I alredy tried to convert it to .jks. I did try to exclue it from filtering on .pom with:

<resources>
<resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
    <excludes>
        <exclude>**/*.p12</exclude>
    </excludes>
</resource>
<resource>
    <directory>src/main/resources</directory>
    <filtering>false</filtering>
    <includes>
        <include>**/*.p12</include>
    </includes>
</resource>

Nothing seems to work.

Obs.: It only happens after I built the project, it run normal if I execute the main class on the IDE.

Upvotes: 2

Views: 202

Answers (0)

Related Questions