0

I'm trying to use the pyjks module to grab keys from a keystore, however loading the keystore fails with the following error:

ValueError: Hash mismatch; incorrect password or data corrupted

If I try using keytool to load the keystore, I have no issues. I was wondering if anyone has ever used pyjks to do this and done so successfully. Here's my python code snippet:

ks = jks.KeyStore.load("/tmp/keystore.jceks", "changeit")
Florin Stingaciu
  • 8,085
  • 2
  • 24
  • 45

1 Answers1

1

Disclaimer: I wrote the initial JCEKS support for pyjks.

This might be due to the lack of support for SecretKey entries at the time. The parsing routine tracks the current position in the file as it reads through it, and at the end expects the next N bytes to be the correct signature. Because SecretKeys were not yet implemented, they did not advance the current position, thus causing a bad hash check.

I'm responding because I recently added the missing SecretKey support to pyjks. So if your situation is still relevant, feel free to grab the latest source from https://github.com/doublereedkurt/pyjks and try it out.

voetsjoeba
  • 435
  • 4
  • 12