bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
241 stars 125 forks source link

Fix assert statement in aesCbcEncrypt() and aesCbcDecrypt() #222

Open elliotwutingfeng opened 10 months ago

elliotwutingfeng commented 10 months ago

According to the documentation

The paddedPlainText must be a multiple of the block size (128-bits).

However the assert statement assert(128 == paddedPlaintext.length * 8); checks if paddedPlaintext is exactly 128-bits long.

They should be switched to assert(0 == paddedPlaintext.length % 16); (16 bytes = 128 bits)