|
THotPDF.CryptKeyLength
|
ด้านบน ก่อนหน้า ถัดไป |
|
กำหนดวิธีการเข้ารหัสไฟล์ PDF
ประเภท THPDFKeyType = ( k40, k128, aes128, aes256 );
Delphi syntax: property CryptKeyLength: THPDFKeyType;
C++ syntax: __property THPDFKeyType CryptKeyLength;
คำอธิบาย ใช้ CryptKeyLength เพื่อเลือกเวอร์ชันการแก้ไขตัวจัดการความปลอดภัยมาตรฐานและรหัสที่ใช้เมื่อเปิดใช้งาน ActivateProtection
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 Standard security handler V=4, R=4 พร้อม crypt filter StdCF (CFM=AESV2) AES-128 ในโหมด CBC พร้อม PKCS#7 padding และ initialization vector สุ่ม 16-byte ตาม ISO 32000-1 7.6.2 / 7.4.4.2 (PDF 1.6+) ตั้งแต่ HotPDF v2.4.0 ตัวเลือกนี้ encrypt strings และ streams ด้วย implementation AES จริง aes256 Standard security handler V=5 พร้อม crypt filter StdCF (CFM=AESV3) AES-256 ในโหมด CBC พร้อม PKCS#7 padding และ initialization vector สุ่ม 16-byte ตาม Adobe Extension Level 3 / ISO 32000-2 7.6.4 (PDF 1.7+, รองรับโดย Acrobat 9 และใหม่กว่า, Foxit, Chrome และ viewers ของ Apple/macOS) ใช้ได้ตั้งแต่ HotPDF v2.4.0
ตัวจัดการความปลอดภัยคีย์สาธารณะ (PDF 1.7 7.6.5) สำหรับการเข้ารหัสโดยใช้ใบรับรอง (หนึ่งเอกสาร ผู้รับหลายราย) ให้เรียกใช้ EnablePubKeyEncryption(seed, KeyType, EncryptMetadata) แทนการตั้งค่า UserPassword / OwnerPassword โดยใช้ค่า CryptKeyLength เดียวกันกับรหัสสมมาตร (k40 -> RC4-40 / V=1 + s4 SubFilter, k128 -> RC4-128 / V=2 + s5, aes128 -> AES-128 / V=4 + s5) ผู้เรียกใช้ต้องสร้างบล็อบ envelopedData ของ PKCS#7 หนึ่งรายการต่อผู้รับ (ผ่าน Windows CryptoAPI, OpenSSL หรือ pycryptodome) และเพิ่มแต่ละบล็อบผ่าน AddPubKeyRecipient โดยคีย์การเข้ารหัสไฟล์จะรับมาจากอัลกอริทึม 9 (SHA-1 ของ seed ที่ต่อเชื่อมกับข้อมูลไบนารีของซองข้อมูล) เริ่มใช้งานได้ตั้งแต่ HotPDF v2.33.0
Code Example
ดูเพิ่มเติม: ActivateProtection, OwnerPassword, ProtectOptions, UserPassword
|