fix(api): accept empty decrypted plaintext

This commit is contained in:
Hugo Pointcheval 2023-04-04 23:22:43 +02:00
parent 5be6296829
commit 2f22cc549d
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC
2 changed files with 5 additions and 7 deletions

View File

@ -288,13 +288,6 @@ class AES implements Cipher<AESCipherChunk> {
);
}
if (bytes.isEmpty) {
throw NativeCryptoException(
code: NativeCryptoExceptionCode.invalidData,
message: 'Platform returned no data on chunk #$count',
);
}
return bytes;
}
}

View File

@ -6,8 +6,13 @@
abstract class Constants {
/// The default chunk size in bytes used for encryption and decryption.
///
/// ~32MB
static const int defaultChunkSize = 33554432;
/// The length of the initialization vector in bytes used for AES GCM.
static const int aesGcmNonceLength = 12;
/// The length of the tag in bytes used for AES GCM.
static const int aesGcmTagLength = 16;
}