FortisAesKey class AES

An AES symmetric key used for both encryption and decryption.

AES is a symmetric cipher — the same key encrypts and decrypts. Supported key sizes are 128, 192, and 256 bits.

To generate a key, use the builder (defaults to 256 bits):

final key = await Fortis.aes().generateKey();

To import an existing key, use fromBytes or fromBase64.

See also:

Constructors

FortisAesKey.fromBase64(String b64)
Imports an AES key from a Base64-encoded string.
factory
FortisAesKey.fromBytes(Uint8List bytes)
Imports an AES key from raw bytes.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
keySize int
The key size in bits — 128, 192, or 256.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBase64() String
Encodes the key as a Base64 string — convenient for storage in .env files, databases, or JSON.
toBytes() Uint8List
Returns a copy of the raw key bytes (16, 24, or 32 bytes).
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromTrustedBytes(Uint8List bytes) FortisAesKey
Fast-path factory used internally by the builder and ECDH derivation.