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 KeyEncryptionKey: TAes256Key;
const PlainKeyData: TBytes): TBytes;
function Aes256KeyUnwrap(const KeyEncryptionKey: TAes256Key; const WrappedKeyData: TBytes;
out PlainKeyData: TBytes): Boolean;
procedure AesGenerateRandomBytes(Buffer: Pointer; Count: Integer);
FPdfAes è un'implementazione AES senza dipendenze fornita affinché PDFium Delphi Component possa crittografare e decrittare i flussi PDF su Delphi, C++Builder e Free Pascal senza affidarsi a una libreria crittografica esterna. Viene consumata dal security handler AES-256 PDF in FPdfEncrypt e dalla modalità GCM in FPdfAesGcm
Le primitive a blocchi operano su blocchi fissi di 16 byte tramite chiavi rotonde espanse. I wrapper CBC gestiscono il padding PKCS#7 o nessun padding su array di byte a lunghezza variabile, corrispondendo alle due modalità di crittografia dei flussi richieste dalla specifica PDF
AesGenerateRandomBytes riempie un buffer con byte casuali crittograficamente usati per IV, salt e chiavi
| Function | Description |
|---|---|
Aes128KeyExpansion | Espande una chiave a 128 bit nel programma di round-key a 176 byte |
Aes128EncryptBlock | Cifra un blocco da 16 byte con una chiave AES-128 espansa |
Aes256KeyExpansion | Espande una chiave a 256 bit nel programma di round-key a 240 byte |
Aes256EncryptBlock | Cifra un blocco da 16 byte con una chiave AES-256 espansa |
Aes256DecryptBlock | Decifra un blocco da 16 byte con una chiave AES-256 espansa |
Aes256CbcEncryptPKCS7 | Cifra un array di byte in modalità CBC con padding PKCS#7 |
Aes256CbcEncryptNoPad | Cifra un array di byte in modalità CBC senza padding (la lunghezza dell'input deve essere un multiplo del blocco) |
Aes256CbcDecryptPKCS7 | Decifra un ciphertext CBC e rimuove il padding PKCS#7 |
Aes256CbcDecryptNoPad | Decifra un ciphertext CBC senza rimuovere il padding |
Aes256KeyWrap | Incapsula dati di chiave con AES-256 usando la protezione di integrità RFC 3394 |
Aes256KeyUnwrap | Autentica e disincapsula dati di chiave RFC 3394, senza restituire plaintext in caso di fallimento dell'integrità |
AesGenerateRandomBytes | Riempie un buffer con byte casuali crittografici |
| Type | Description |
|---|---|
TAesBlock | Un blocco dati AES da 16 byte, l'unità delle primitive a blocco singolo e del passaggio di concatenamento CBC, nonché il tipo IV dei wrapper CBC |
TAes128Key | Chiave AES-128 da 16 byte accettata da Aes128KeyExpansion |
TAes128ExpandedKey | Round-key schedule AES-128 di 176 byte prodotto da Aes128KeyExpansion e consumato da Aes128EncryptBlock |
TAes256Key | Chiave AES-256 da 32 byte accettata da Aes256KeyExpansion, dai wrapper CBC e dalle funzioni di key-wrap RFC 3394 |
TAes256ExpandedKey | Round-key schedule AES-256 di 240 byte che copre tutti i 14 round, prodotto da Aes256KeyExpansion e consumato dalle routine di cifratura/decifratura a blocco e CBC |
| Constant | Value | Description |
|---|---|---|
AES_BLOCK_SIZE | 16 | Dimensione del blocco AES in byte |
AES128_KEY_SIZE | 16 | Dimensione della chiave AES-128 in byte |
AES128_ROUND_KEY_SIZE | 176 | Dimensione del round-key AES-128 espanso in byte |
AES256_KEY_SIZE | 32 | Dimensione della chiave AES-256 in byte |
AES256_ROUND_KEY_SIZE | 240 | Dimensione del round-key AES-256 espanso in byte |