"padding is invalid and cannot be removed?" Code Answer


rijndael/aes is a block cypher. it encrypts data in 128 bit (16 character) blocks. cryptographic padding is used to make sure that the last block of the message is always the correct size.

your decryption method is expecting whatever its default padding is, and is not finding it. as @netsquirrel says, you need to explicitly set the padding for both encryption and decryption. unless you have a reason to do otherwise, use pkcs#7 padding.

By Sejwal on June 19 2022

Answers related to “padding is invalid and cannot be removed?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.