AESEncryptor class

Encrypt and decrypt text with AES-GCM.

Each message gets a new random 12-byte nonce. The output is base64 of nonce + ciphertext + tag. The 16-byte tag lets decode find any change to the text.

associatedData binds the text to a context, like a cookie name. It is not stored in the output. decode needs the same value, or it fails. So a value made for one cookie can not be used as another.

Constructors

AESEncryptor()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Methods

decode(String content, String secret, {String associatedData = ''}) → String
decode a message. Throws DecryptException when the text was changed or the key is wrong.
encode(String content, String secret, {String associatedData = ''}) → String
encode a message