TAesBlock = array[0..15] of Byte;
TAes128Key = array[0..15] of Byte;
TAes128ExpandedKey = array[0..175] of Byte;
TAes256Key = array[0..31] of Byte;
TAes256ExpandedKey = array[0..239] of Byte;
procedure Aes128KeyExpansion(const Key: TAes128Key; var Expanded: TAes128ExpandedKey);
procedure Aes128EncryptBlock(const Expanded: TAes128ExpandedKey;
const Input: TAesBlock; var Output: TAesBlock);
procedure Aes256KeyExpansion(const Key: TAes256Key; var Expanded: TAes256ExpandedKey);
procedure Aes256EncryptBlock(const Expanded: TAes256ExpandedKey;
const Input: TAesBlock; var Output: TAesBlock);
procedure Aes256DecryptBlock(const Expanded: TAes256ExpandedKey;
const Input: TAesBlock; var Output: TAesBlock);
function Aes256CbcEncryptPKCS7(const Key: TAes256Key; const IV: TAesBlock;
const Plain: TBytes): TBytes;
function Aes256CbcEncryptNoPad(const Key: TAes256Key; const IV: TAesBlock;
const Plain: TBytes): TBytes;
function Aes256CbcDecryptPKCS7(const Key: TAes256Key; const IV: TAesBlock;
const Cipher: TBytes): TBytes;
function Aes256CbcDecryptNoPad(const Key: TAes256Key; const IV: TAesBlock;
const Cipher: TBytes): TBytes;
function Aes256KeyWrap(const Key: TAes256Key;
const PlainKeyData: TBytes): TBytes;
function Aes256KeyUnwrap(const Key: TAes256Key; const Wrapped: TBytes;
out PlainKeyData: TBytes): Boolean;
procedure AesGenerateRandomBytes(Buffer: Pointer; Count: Integer);
FPdfAes er en afhængighedsfri AES-implementering, der leveres, så PDFium Delphi Component kan kryptere og dekryptere PDF-streams på Delphi, C++Builder og Free Pascal uden at stole på et eksternt kryptobibliotek. Den forbruges af PDF AES-256-sikkerhedshandleren i FPdfEncrypt og af GCM-tilstanden i FPdfAesGcm
Blokprimitiverne arbejder på faste 16-byte-blokke via udvidede round keys. CBC-wrapperne håndterer PKCS#7-padding eller ingen padding over byte-arrays af variabel længde, hvilket matcher de to stream-krypteringstilstande, PDF-specifikationen kræver
AesGenerateRandomBytes fylder en buffer med kryptografisk tilfældige bytes, der bruges til IV'er, salt og nøgler
| Function | Description |
|---|---|
Aes128KeyExpansion | Expands a 128-bit key into the 176-byte round-key schedule |
Aes128EncryptBlock | Encrypts one 16-byte block with an expanded AES-128 key |
Aes256KeyExpansion | Expands a 256-bit key into the 240-byte round-key schedule |
Aes256EncryptBlock | Encrypts one 16-byte block with an expanded AES-256 key |
Aes256DecryptBlock | Decrypts one 16-byte block with an expanded AES-256 key |
Aes256CbcEncryptPKCS7 | Encrypts a byte array in CBC mode with PKCS#7 padding |
Aes256CbcEncryptNoPad | Encrypts a byte array in CBC mode without padding (input length must be a block multiple) |
Aes256CbcDecryptPKCS7 | Decrypts a CBC ciphertext and strips PKCS#7 padding |
Aes256CbcDecryptNoPad | Decrypts a CBC ciphertext without removing padding |
Aes256KeyWrap | Wraps key data with AES-256 using RFC 3394 integrity protection |
Aes256KeyUnwrap | Authenticates and unwraps RFC 3394 key data, returning no plaintext on integrity failure |
AesGenerateRandomBytes | Fills a buffer with cryptographically random bytes |
| Constant | Value | Description |
|---|---|---|
AES_BLOCK_SIZE | 16 | AES block size in bytes |
AES128_KEY_SIZE | 16 | AES-128 key size in bytes |
AES128_ROUND_KEY_SIZE | 176 | Expanded AES-128 round-key size in bytes |
AES256_KEY_SIZE | 32 | AES-256 key size in bytes |
AES256_ROUND_KEY_SIZE | 240 | Expanded AES-256 round-key size in bytes |