aes_crypt icon indicating copy to clipboard operation
aes_crypt copied to clipboard

ECB without IV

Open jeffersonfr opened this issue 4 years ago • 0 comments

The following code isn't possible ...

crypt.aesSetMode(AesMode.ecb);
crypt.aesSetKeys(keyBytes, Uint8List(0));

The only way was copy the project and comment the line below:

void aesSetKeys(Uint8List key, [Uint8List iv]) {
  if (![16, 24, 32].contains(key.length)) {
    throw AesCryptArgumentError('Invalid key length for AES. Provided ${key.length * 8} bits, expected 128, 192 or 256 bits.');
  } else if (_aesMode != AesMode.ecb && iv.isNullOrEmpty) {
    throw AesCryptArgumentError('The initialization vector is not specified. It can not be empty when AES mode is not ECB.');
  } else if (iv.length != 16) {
    // throw AesCryptArgumentError('Invalid IV length for AES. The initialization vector must be 128 bits long.');
}

jeffersonfr avatar Jun 06 '20 05:06 jeffersonfr