GoogleSearchBox

Custom Search

Monday, June 17, 2013

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

# keytool -importkeystore -deststorepass changeit -destkeypass changeit -destkeystore myServerKeystore.jks -srckeystore /etc/pki/tls/tomcat6-CAS-certs/216-113-229-31-serverCertAsPK12.p12  -srcstoretype PKCS12 -alias servercertificate 
Result:
Enter source keystore password:
keytool error: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded

Shown in picture as below:


We get the error, because, we have to use the password which we had used while creating the server pk12 file.
Now if you get it correct, you should not get any message after the password prompt and the JKS file should have created.