decrypt method
Decrypts a ciphertext.
Parameter keyStreamIndex
allows you to choose offset in the keystream.
For other arguments, see Cipher.decrypt
.
Implementation
@override
Future<List<int>> decrypt(
SecretBox secretBox, {
required SecretKey secretKey,
List<int> aad = const <int>[],
int keyStreamIndex = 0,
Uint8List? possibleBuffer,
}) {
if (!kIsWeb &&
isSupportedPlatform &&
FlutterCryptography.isPluginPresent &&
channelPolicy.matches(length: secretBox.cipherText.length)) {
return FlutterCipher.decryptWithPlugin(
name: channelCipherName,
cipher: this,
fallback: this.fallback,
secretBox: secretBox,
secretKey: secretKey,
aad: aad,
);
}
final fallback = this.fallback;
if (fallback == null) {
throw UnsupportedError('No fallback was specified.');
}
return fallback.decrypt(
secretBox,
secretKey: secretKey,
aad: aad,
);
}