aesEcb<T extends Object?> static method

T aesEcb<T extends Object?>(
  1. List<int> key,
  2. T use(
    1. BuAesEcb cipher
    ), {
  3. PaddingAlgorithm? padding = PaddingAlgorithm.pkcs7,
})

Runs use with a fresh AES-ECB cipher, then wipes it. The instance must be clean after you don't need it; this method guarantees that, even if use throws.

Implementation

static T aesEcb<T extends Object?>(
  List<int> key,
  T Function(BuAesEcb cipher) use, {
  PaddingAlgorithm? padding = PaddingAlgorithm.pkcs7,
}) {
  final cipher = aesEcbInstance(key, padding: padding);
  try {
    return use(cipher);
  } finally {
    cipher.clean();
  }
}