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 (viaEVP_CTRL_AEAD_SET_IVLEN), shorter ones are rejected, see minNonceLength.factory -
Aead.chacha20Poly1305(List<
int> key) -
ChaCha20-Poly1305 (RFC 8439) with a 32-byte
keyand 12-byte nonce.factory
Properties
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:
openonciphertext || tag. -
seal(
List< int> nonce, List<int> plaintext, {List<int> aad = const []}) → SealedBox -
Encrypts and authenticates
plaintextwithnonceand optionalaad. -
sealCombined(
List< int> nonce, List<int> plaintext, {List<int> aad = const []}) → Uint8List -
Convenience:
sealreturningciphertext || 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.