Aead class final

An AEAD cipher bound to a key.

Constructors

Aead.aes128Gcm(List<int> key)
AES-128-GCM with a 16-byte key.
factory
Aead.aes256Gcm(List<int> key)
AES-256-GCM with a 32-byte key. Nonce: 12 bytes recommended; longer nonces are accepted (via EVP_CTRL_AEAD_SET_IVLEN), shorter ones are rejected, see minNonceLength.
factory
Aead.chacha20Poly1305(List<int> key)
ChaCha20-Poly1305 (RFC 8439) with a 32-byte key and 12-byte nonce.
factory

Properties

algorithm → String
OpenSSL algorithm name, e.g. AES-256-GCM.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tagLength → int
Tag length in bytes (16).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(List<int> nonce, SealedBox box, {List<int> aad = const []}) → Uint8List
Verifies and decrypts box. Throws AuthenticationException on any mismatch of key, nonce, AAD, ciphertext or tag.
openCombined(List<int> nonce, List<int> combined, {List<int> aad = const []}) → Uint8List
Convenience: open on ciphertext || tag.
seal(List<int> nonce, List<int> plaintext, {List<int> aad = const []}) → SealedBox
Encrypts and authenticates plaintext with nonce and optional aad.
sealCombined(List<int> nonce, List<int> plaintext, {List<int> aad = const []}) → Uint8List
Convenience: seal returning ciphertext || tag.
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

minNonceLength → const int
Shortest nonce seal and open accept, in bytes. 96 bits is what GCM (NIST SP 800-38D) and ChaCha20-Poly1305 (RFC 8439) are specified for; GCM technically takes shorter nonces, but they shrink the space a random nonce is drawn from and are a classic mistake, so they are refused. Longer GCM nonces are hashed down to 96 bits by OpenSSL and accepted.