Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

ssl

tomcat

jks

I ran the following command to create a JKS file from a PFX file for use in Tomcat:

keytool -importkeystore -srckeystore PFX_P12_FILE_NAME -srcstoretype pkcs12 -srcstorepass PFX_P12_FILE -srcalias SOURCE_ALIAS -destkeystore KEYSTORE_FILE -deststoretype jks -deststorepass PASSWORD -destalias ALIAS_NAME

But I am getting the following error:

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

How is this caused and how can I solve it?

like image 535
shwetakpgt Avatar asked Apr 06 '13 13:04

shwetakpgt


1 Answers

I ran into the same issue, and found the answer to be quite simple. See below:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6974037

Apparently, this error may be thrown when either the passwords do not match or the new passwords you are entering does not meet the criteria. In my case, it was the latter.

like image 153
Allen Paul Avatar answered Oct 11 '22 04:10

Allen Paul