AesCipher class final
AES-256-GCM authenticated encryption cipher for quantum_cache.
Security properties:
- Key: 256-bit (32 bytes) — brute-force resistant.
- Mode: GCM (Galois/Counter Mode) — provides both confidentiality and authenticity. Any tampered ciphertext is detected and rejected.
- IV/Nonce: 96-bit (12 bytes) — randomly generated per encryption call. Using a fresh nonce each time prevents nonce-reuse attacks.
- Auth tag: 128-bit (16 bytes) — appended to the ciphertext.
Wire format:
[ 12 bytes ] IV (random nonce)
[ n bytes ] AES-256-CTR encrypted payload
[ 16 bytes ] GCM authentication tag
Total overhead per value: 28 bytes.
Usage:
final key = AesCipher.generateKey(); // save this securely!
await SuperCache.init(
config: CacheConfig(encryptionKey: key),
);
- Implemented types
Properties
- algorithmName → String
-
Human-readable name of this cipher (used in debug output).
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decrypt(
Uint8List ciphertext) → Uint8List -
Decrypts
ciphertextand returns the original plaintext.override -
encrypt(
Uint8List plaintext) → Uint8List -
Encrypts
plaintextand returns the ciphertext.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited