Aes class

AES block cipher (FIPS 197) with the CBC modes PDF encryption needs (§7.6.2, §7.6.4.3): content decryption (16-byte IV prefix, PKCS#7 padding) and the unpadded CBC encryption inside the AES-256 password hash (Algorithm 2.B). Pure Dart so it runs on the VM and the web.

Constructors

Aes(List<int> key)
Key must be 16, 24, or 32 bytes.

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

cbcDecrypt(List<int> iv, Uint8List data) Uint8List
Decrypts with CBC and no padding; data must be block-aligned.
cbcEncrypt(List<int> iv, Uint8List data) Uint8List
Encrypts with CBC and no padding; data must be block-aligned. Used by Algorithm 2.B and by test fixtures (with PKCS#7 applied by the caller).
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

decryptContent(List<int> key, Uint8List data) Uint8List
Decrypts a PDF content payload: leading 16-byte IV, then ciphertext. PKCS#7 padding is stripped leniently (real files get it wrong); payloads too short or misaligned yield empty/truncated output rather than throwing.
encryptContent(List<int> key, Uint8List data, List<int> iv) Uint8List
Encrypts a PDF content payload: PKCS#7-pads data, prepends the 16-byte iv, CBC-encrypts. The inverse of decryptContent.