decrypt method

  1. @override
Future<List<int>> decrypt(
  1. SecretBox secretBox, {
  2. required SecretKey secretKey,
  3. List<int> aad = const <int>[],
  4. int keyStreamIndex = 0,
})
override

Decrypts SecretBox and returns the bytes.

Subclasses of Cipher do the following: 1.Authenticates SecretBox.mac with macAlgorithm. 2.Decrypts SecretBox.cipherText. 3.Returns the cleartext.

The SecretBox is authenticated with [SecretBox.checkMac()), which will throw SecretBoxAuthenticationError if the MAC is incorrect.

You must give a SecretKey that has the correct length and type.

Optional parameter nonce (also known as "initialization vector", "IV", or "salt") is some non-secret unique sequence of bytes. If you don't define it, the cipher will generate nonce for you.

Parameter aad can be used to pass Associated Authenticated Data (AAD). If you pass a non-empty list and the underlying cipher doesn't support AAD, the method will throw ArgumentError.

Implementation

@override
Future<List<int>> decrypt(
  SecretBox secretBox, {
  required SecretKey secretKey,
  List<int> aad = const <int>[],
  int keyStreamIndex = 0,
}) {
  return fallback.decrypt(
    secretBox,
    secretKey: secretKey,
    aad: aad,
    keyStreamIndex: keyStreamIndex,
  );
}