AesAuthPayload class AES
The output of an AES authenticated encryption operation (AesMode.gcm, AesMode.ccm).
Contains the three components returned separately by many external systems (.NET, Java, OpenSSL) when using authenticated encryption modes:
- iv: the initialization vector. In GCM and CCM this is technically a "nonce" (number used once) — the terms are equivalent here (IETF RFC 5084). Default size 12 bytes (GCM) or 11 bytes (CCM), Base64-encoded.
- data: the ciphertext, Base64-encoded.
- tag: the authentication tag (16 bytes by default), Base64-encoded. Used to verify integrity and authenticity on decryption.
Produced by AesAuthCipher.encryptToPayload — the return type is statically inferred (no cast required):
final key = await Fortis.aes().generateKey();
final cipher = Fortis.aes().gcm().cipher(key); // AesAuthCipher
final AesAuthPayload payload = cipher.encryptToPayload('hello');
print(payload.tag); // typed — no cast
// Serialize for a .NET/Java backend that expects 'nonce':
final json = jsonEncode(payload.toMap(ivKey: 'nonce'));
See also:
- AesAuthCipher.encryptToPayload, which produces this payload.
- AesPayload, the same output for the non-authenticated modes — no tag, because those modes provide no integrity guarantee.
- AesCipher.decrypt, which accepts this payload back for decryption.
Constructors
- AesAuthPayload({required String iv, required String data, required String tag})
-
Creates an AesAuthPayload with the given
iv,data, andtag.const
Properties
- data → String
-
The ciphertext, Base64-encoded.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iv → String
-
The initialization vector (nonce), Base64-encoded.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tag → String
-
The authentication tag, Base64-encoded.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
{String ivKey = 'iv'}) → Map< String, String> -
Converts this payload to a
Map<String, String>. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited