I have found another corner case that can provoke this message.
I exported a PKCS12 keystore with openssl
and then tried to import it into an existing keystore with keytool
. I received the 'integrity check failed' error at this step despite the password being good when I listed the contents of the PKCS12 keystore.
The problem turned out to be because I'd used a password exactly 50 characters long. Although this is accepted by openssl
, I understand that this is the maximum size of the buffer used and that the last character of the password get overwritten by an 'end of string' character.
Exporting the PKCS12 keystore again with a password of only 49 characters long fixed my issue.