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:
- AesBuilder.generateKey, which produces a random key of the configured size.
- AesModeBuilder.cipher, which turns this key into an AesCipher.
- EcdhKeyDerivation.deriveAesKey, which derives one from a shared secret instead of generating it.
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
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.