3

I'm trying to convert a private key in a Java Keystore into PEM Format. This answer explains that the first step is to convert the keystore into PKCS12 format using the keytool command.

However, I get the following error:

$ keytool -importkeystore -srckeystore client.keystore.jks -destkeystore client1.p12 -srcstoretype JKS -deststoretype PKCS12 -srcalias client1 -destalias client1
...
keytool error: java.io.IOException: DER input, Integer tag error

Searching for this error online tells me that this has to do with encryption. I know the source keystore is encrypted, but supplying the passwords in the command gives the exact same error. How can I export the private key?

1 Answer 1

1

The issue turned out to be the destination keystore, not the source one. The file client1.p12 already existed but it was in an incompatible format.

The solution was to remove the file client1.p12 and run the keytool command again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.