Java - Crypto

> Procedural Languages > Java

1 - About

Cryptography in Java

2 - Support

2.1 - javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.

Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:991)
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847)
	at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
	at javax.crypto.Cipher.doFinal(Cipher.java:2164)

This problem may be caused by a bad key but this is also the case when you are not using the same salt.

Solution:

  • Save the salt along with the password
Advertising
lang/java/crypto.txt · Last modified: 2019/07/09 08:52 by gerardnico