Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes keytool error "Failed to decrypt safe contents entry"?

I am trying to convert a standard PKCS #12 (.p12) key store into a Java JKS key store with this command:

keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks

It is failing with:

keytool error: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded 

Do you have any idea how to solve this problem?

like image 412
Pedro Rolo Avatar asked Apr 26 '12 17:04

Pedro Rolo


People also ask

How do I find my JKS password?

From the logs: If you have your logs intact, then you can find the password in the Android Studio log files: Go to ~/Library/Logs -> AndroidStudio ->idea. log.

What is Keytool used for?

keytool is a key and certificate management utility. It allows users to administer their own public/private key pairs and associated certificates for use in self-authentication (where the user authenticates himself/herself to other users/services) or data integrity and authentication services, using digital signatures.


2 Answers

Sometimes this error is symptomatic of using an incorrect password for the p12 key.

like image 111
William Grand Avatar answered Sep 22 '22 19:09

William Grand


The pkcs12 keystore was corrupt indeed.

like image 43
Pedro Rolo Avatar answered Sep 21 '22 19:09

Pedro Rolo