Closed ghost closed 5 years ago
Thanks to a helpful person on Stack Overflow I was able to get this up and running. This is the way to do it if you have no need for padding:
BlockCipher cipher = ECBBlockCipher(AESFastEngine());
cipher.init(true,KeyParameter(key));
Uint8List encrypted = cipher.process(inputData);
I'm testing currently trying to figure out how to encrypt a binary array using AES ECB encryption. Both the AES key and the data I want to encrypt are presented as binary arrays, if I've understood everything correct I won't need to pad the array containing the data if it matches the key's length?
Here is the code I've got so far:
This results in the following error message: I/flutter (55555): The following assertion was thrown while handling a gesture: I/flutter (55555): type 'PaddedBlockCipherParameters<KeyParameter, Null>' is not a subtype of type 'KeyParameter' of 'params'
Any ideas about what I'm missing or what I'm doing wrong? I've looked at one similar issue that seems to be solved, but it didn't resolve my problem. https://github.com/PointyCastle/pointycastle/issues/167