encrypt method

EncryptionResult encrypt(
  1. List<int> data, {
  2. List<int>? initializationVector,
  3. List<int>? additionalAuthenticatedData,
  4. String? algorithm,
})

Encrypt content

Implementation

EncryptionResult encrypt(List<int> data,
    {List<int>? initializationVector,
    List<int>? additionalAuthenticatedData,
    String? algorithm}) {
  _assertCanDo('encrypt');
  algorithm ??= this.algorithm;
  var encrypter =
      _keyPair.publicKey!.createEncrypter(_getAlgorithm(algorithm));
  return encrypter.encrypt(Uint8List.fromList(data),
      initializationVector: initializationVector != null
          ? Uint8List.fromList(initializationVector)
          : null,
      additionalAuthenticatedData: additionalAuthenticatedData != null
          ? Uint8List.fromList(additionalAuthenticatedData)
          : null);
}