AES class

Represents an Advanced Encryption Standard (AES) block cipher.

The AES class implements the BlockCipher interface and provides methods for encryption and decryption of data using the AES algorithm. It supports key lengths of 128, 192, and 256 bits.

Key Schedule:

  • The key schedule is computed during key initialization using the _lib AES library.

Block Size:

  • AES operates on 128-bit blocks of data.

Key Initialization:

  • To initialize the cipher with a key, use the setKey method.

Encryption and Decryption:

  • Use the encryptBlock method to encrypt a 128-bit block of data.
  • Use the decryptBlock method to decrypt a 128-bit block of data (if the instance allows decryption).

Memory Cleanup:

  • The clean method can be used to securely zero and release the internal key schedule data.

Note: This class should be used with caution, as it operates directly on byte arrays and requires proper key management and memory cleanup to ensure security.

Implemented types
Implementers

Constructors

AES(List<int> key, [bool noDecryption = false])
Creates an AES cipher instance with the given encryption key.

Properties

blockSize int
Block size for AES cipher
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clean() AES
Clears and releases internal key schedule data for security and memory management.
override
decryptBlock(List<int> src, [List<int>? dst]) List<int>
This method takes a source block of ciphertext, decrypts it using the decryption key schedule, and returns the resulting plaintext. Optionally, you can provide a destination block (dst) to write the decrypted data into. If not provided, a new List
override
encryptBlock(List<int> src, [List<int>? dst]) List<int>
This method takes a source block of plaintext, encrypts it using the encryption key schedule, and returns the resulting ciphertext. Optionally, you can provide a destination block (dst) to write the encrypted data into. If not provided, a new List
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setKey(List<int> key, [bool noDecryption = false]) AES
Initializes the AES cipher with the provided encryption key.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited