Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data length for AES in binary data AES encryption/decryption example #5

Open
asavchuk opened this issue May 25, 2020 · 0 comments
Open

Comments

@asavchuk
Copy link

asavchuk commented May 25, 2020

Error for example of binary data AES encryption/decryption:

      Uint8List key = Uint8List.fromList(
          [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
      Uint8List iv = Uint8List.fromList(
          [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
    
      var crypt = AesCrypt('my cool password');
      crypt.aesSetParams(key, iv, AesMode.cbc);
    
      Uint8List srcData = Uint8List.fromList([1, 2, 3, 4, 5]);
    
      Uint8List encryptedData = crypt.aesEncrypt(srcData); // error on this line
      Uint8List decryptedData = crypt.aesDecrypt(encryptedData);
Invalid argument(s): Invalid data length for AES: 5 bytes.
#0      _Aes.aesEncrypt (package:aes_crypt/src/aes.dart:244:7)
#1      AesCrypt.aesEncrypt (package:aes_crypt/src/aescrypt.dart:370:48)
#2      main (package:aestest/aes.dart:36:35)
#3      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
@asavchuk asavchuk changed the title Invalid data length for AES Data length for AES in binary data AES encryption/decryption example May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant