|
Determines PDF file encryption method.
type
THPDFKeyType = ( k40, k128, aes128, aes256 );
Delphi 구문:
property CryptKeyLength: THPDFKeyType;
C++ 구문:
__property THPDFKeyType CryptKeyLength;
설명
ActivateProtection이 enabled일 때 사용할 standard security handler revision과 cipher를 선택하려면 CryptKeyLength를 사용하십시오
Value Meaning
k40 Standard security handler V=1, R=2, RC4 with a 40-bit key (PDF 1.1+).
k128 Standard security handler V=2, R=3, RC4 with a 128-bit key (PDF 1.4+).
aes128은 crypt filter StdCF(CFM=AESV2)를 사용하는 standard security handler V=4, R=4입니다. ISO 32000-1 7.6.2 / 7.4.4.2(PDF 1.6+)에 따라 PKCS#7 padding 및 16-byte random initialization vector를 사용하는 CBC mode AES-128입니다. HotPDF v2.4.0부터 이 option은 실제 AES implementation으로 string과 stream을 encrypt합니다. 이전 build는 AES dictionary를 emit했지만 content를 실제로 encrypt하지 않았습니다
aes256은 crypt filter StdCF(CFM=AESV3)를 사용하는 standard security handler V=5입니다. Adobe Extension Level 3 / ISO 32000-2 7.6.4(PDF 1.7+, Acrobat 9 이상, Foxit, Chrome, Apple/macOS viewer에서 허용)에 따라 PKCS#7 padding 및 16-byte random initialization vector를 사용하는 CBC mode AES-256입니다. HotPDF v2.17.0부터 사용할 수 있습니다. Default revision은 SHA-256 password hashing을 사용하는 R=5입니다. ISO 32000-2 algorithm 2.B "hash dance"(SHA-256 / SHA-384 / SHA-512 + AES-128 mixer)를 사용하는 R=6으로 전환하려면 UseAES256R6를 true로 설정하십시오. R=6은 Acrobat DC 및 PDF/A-4 validator에서 필요합니다. HotPDF v2.22.0부터 사용할 수 있습니다
Public-Key Security Handler (PDF 1.7 7.6.5)
For certificate-based encryption (one document, multiple recipients) call EnablePubKeyEncryption(seed, KeyType, EncryptMetadata) instead of setting UserPassword / OwnerPassword. The same CryptKeyLength values apply to the symmetric cipher (k40 -> RC4-40 / V=1 + s4 SubFilter, k128 -> RC4-128 / V=2 + s5, aes128 -> AES-128 / V=4 + s5). Caller must build one PKCS#7 envelopedData blob per recipient (Windows CryptoAPI, OpenSSL, or pycryptodome) and append each blob through AddPubKeyRecipient; the file encryption key derives through algorithm 9 (SHA-1 of seed concatenated with the envelope binaries). Available since HotPDF v2.33.0.
Code Example
HPDF.OwnerPassword := 'password'; // Set owner password (required to change security settings)
HPDF.UserPassword := 'user'; // Set user password (required to open the document)
HPDF.ProtectOptions := [poEdit, poAnnot]; // Disallow editing and annotations
HPDF.ActivateProtection := true; // Enable PDF security
참조: ActivateProtection, OwnerPassword, ProtectOptions, UserPassword
|