THPDFKeyType Type
Selects the PDF security handler algorithm and key length used when encrypting a document
Declaration
THPDFKeyType= (k40, k128, aes128, aes256, aesgcm);
Unit
HPDFDoc
Values
| Value | Meaning |
|---|---|
k40 | RC4 40-bit, V=1 R=2 (PDF 1.1+) |
k128 | RC4 128-bit, V=2 R=3 (PDF 1.4+) |
aes128 | AES-128, V=4 R=4 with crypt filter CFM=AESV2 (PDF 1.6+) |
aes256 | AES-256, V=5 R=5 with crypt filter CFM=AESV3 (Adobe Extension Level 3 / PDF 1.7+; recognised by Acrobat 9+) |
aesgcm | AES-256-GCM, V=6 R=7 with crypt filter CFM=AESV4 (ISO/TS 32003:2023 developer extension for PDF 2.0) |
Usage notes
- Assign a value of this type to THotPDF.CryptKeyLength before switching on protection to choose the encryption applied to strings and streams
- Version negotiation may rewrite the effective key type downward (aes256 becomes aes128 under PDF 1.6, aesgcm becomes aes128 below PDF 2.0) instead of writing out an invalid file
- Public-key workflows accept the same values via THotPDF.EnablePubKeyEncryption and THotPDF.AddPubKeyRecipientCertificate, where aes256 emits the V=5 AESV3 crypt filter