encryptWithKeyAndArtefacts method
Future<EncryptionResult>
encryptWithKeyAndArtefacts(
- List<
int> data, - EncryptionKey key,
- EncryptionArtefacts artefacts
override
Allows encryption with specified encryption artifacts (rather than generated ones).
Implementation
@override
Future<EncryptionResult> encryptWithKeyAndArtefacts(
List<int> data, EncryptionKey key, EncryptionArtefacts artefacts) async {
final encrypted = await _cipher.encrypt(data,
secretKey: SecretKey((key as SymmetricKey).bytes),
nonce: artefacts.nonce,
aad: artefacts.authData);
final cipherText = encrypted.cipherText;
final authTag = encrypted.mac.bytes;
artefacts.authTag = authTag;
return EncryptionResult.fromComponents(
strategy: _strategy,
cipherText: cipherText,
encryptionArtefacts: artefacts);
}