javax.crypto.IllegalBlockSizeException: When Decoding an Input String
posted 5 years ago
Hello, I have been given the following class for encrypting and decrypting password strings. I can encrypt ok but I receive errors when I try to decrypt. The error is as follows
EncryptionHelper.encrypt...byte array length: 18EncryptionHelper.encrypt...string interpretation: [B@b179c3 Encrypt len = 44 EncryptionHelper.encrypt...return value: [B@67ac19 String decoded = [B@53ba3d Lent=5 testt Controller.main...exception, illegal block size: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
My class is as follows
The error occurs at the following line "byte recoveredBytes = cipher.doFinal(encryptionBytes);"
How can I confirm that "byte encryptionBytes" will be a multiple of 16?