KeyStore with BouncyCastleProvider: KeyStore integ

2019-06-15 00:59发布

I want to use a self-signed signature for ssl connections. I'm following this post.

My problem: After creating the Keystore my integrity-check fails.

Keytool-Error: java.io.IOException: KeyStore integrity check failed.

I'm still searching but maybe someone can save me some time.

4条回答
可以哭但决不认输i
2楼-- · 2019-06-15 01:43

Make sure you are using the right password to open the keystore. I was having this error and turns out I was still using the password from the example code in trusted.load()

查看更多
该账号已被封号
3楼-- · 2019-06-15 01:49

Ensure your keystore file is properly closed using FileOutputStream.close() or it will be marked as having lost integrity

查看更多
对你真心纯属浪费
4楼-- · 2019-06-15 01:51

I had the same problem where I tried to open a KeyStore file I saved locally and 2 reasons comes to mind:

  • You are storing your KeyStore and loading it with a different password.
  • Your KeyStore file was damaged some how thus flagging the integrity check.

I'd suggest you try to save and load another file with the same password (fixed) just to see if it will load normally.

查看更多
乱世女痞
5楼-- · 2019-06-15 01:52

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.

查看更多
登录 后发表回答