AesGcm class
Implementação do cipher autenticado AES-GCM (AEAD) — NIST SP 800-38D.
Equivalente moderno ao ChaCha20-Poly1305 para casos que exigem AES.
final key = CryptUtil.generateKey(); // 32 bytes → AES-256
final nonce = Uint8List(12);
Random.secure().nextBytes(nonce);
final gcm = AesGcm(key: key, nonce: nonce, aad: Uint8List(0));
final payload = gcm.encrypt(utf8.encode('texto secreto'));
final texto = utf8.decode(gcm.decrypt(payload));
Constructors
Properties
Methods
-
decrypt(
EncryptedPayload payload) → List< int> -
Decifra
payloade retorna o plaintext original. -
encrypt(
List< int> plaintext) → EncryptedPayload -
Cifra
plaintexte retorna um EncryptedPayload com ciphertext e tag GCM. -
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
Constants
- nonceLength → const int
- tagLength → const int