EncryptionUtils

EncryptionUtils

ภาพรวม

EncryptionUtils เป็น class ใน Aspose.PDF FOSS สำหรับ Python.

Utility class สำหรับ PDF-compliant AES-CBC, RC4 encryption, และ key derivation.

คลาสนี้ให้ 15 เมธอดสำหรับทำงานกับ EncryptionUtils objects ในโปรแกรม Python เมธอดที่มีรวมถึง: compute_file_encryption_key, compute_hash_v5, compute_owner_key_v4, compute_user_key_v4, compute_user_owner_keys_v6, decrypt_aes_cbc, decrypt_rc4, decrypt_writer_encrypted_stream, derive_object_key, encrypt_aes_cbc, encrypt_perms_v6, encrypt_rc4, และเมธอดเพิ่มเติม 3 รายการ. สมาชิก public ทั้งหมดสามารถเข้าถึงได้โดยแอปพลิเคชัน Python ใดก็ได้หลังจากติดตั้งแพ็กเกจ Aspose.PDF FOSS สำหรับ Python package.

วิธีการ

ลายเซ็นคำอธิบาย
`encrypt_aes_cbc(key: bytes, data: bytes, iv: bytesNone)→bytes`
decrypt_aes_cbc(key: bytes, data: bytes) → bytesถอดรหัสข้อมูลที่ถูกเข้ารหัสโดย encrypt_aes_cbc.
encrypt_rc4(key: bytes, data: bytes) → bytesเข้ารหัสข้อมูลโดยใช้อัลกอริทึม RC4 (ARC4).
decrypt_rc4(key: bytes, data: bytes) → bytesถอดรหัสข้อมูลโดยใช้อัลกอริทึม RC4 (ARC4).
decrypt_writer_encrypted_stream(file_key: bytes, algorithm: str, obj_id: int, data: bytes) → bytesถอดรหัสไบต์สตรีมที่สร้างโดย :meth:PdfWriterV0._encrypt_data.
compute_owner_key_v4(owner_password: str, user_password: str, key_length: int, revision: int) → bytesคำนวณค่ารหัสผ่านของเจ้าของ (O) ตามอัลกอริทึม 3.3.
compute_file_encryption_key(password: str, o_value: bytes, p_value: int, file_id: bytes, key_length: int, revision: int, encrypt_metadata: bool) → bytesคำนวณคีย์การเข้ารหัสไฟล์ตามอัลกอริทึม 3.2.
compute_user_key_v4(password: str, o_value: bytes, p_value: int, file_id: bytes, key_length: int, revision: int, encrypt_metadata: bool) → tuple[bytes, bytes]คำนวณค่ารหัสผ่านของผู้ใช้ (U) และคีย์การเข้ารหัสตามอัลกอริทึม 3.4/3.5.
verify_password_v4(password: str, u_value: bytes, o_value: bytes, p_value: int, file_id: bytes, key_length: int, revision: int, encrypt_metadata: bool) → `bytesNone`
compute_hash_v5(password: bytes, salt: bytes, user_key: bytes) → bytesคำนวณแฮชสำหรับ V5/R6 ตามอัลกอริทึม 2.B (ISO 32000-2).
`compute_user_owner_keys_v6(user_password: str, owner_password: str, file_key: bytesNone)→tuple[bytes, bytes, bytes, bytes]`
verify_password_v6(password: str, u_value: bytes, o_value: bytes, ue_value: bytes, oe_value: bytes) → `bytesNone`
encrypt_perms_v6(file_key: bytes, p_value: int, encrypt_metadata: bool) → bytesเข้ารหัสสิทธิ์และแฟล็กเมทาดาต้าสำหรับ R6.
derive_object_key(file_key: bytes, obj_num: int, gen_num: int, use_aes: bool) → bytesสรุปคีย์เฉพาะวัตถุตามอัลกอริทึม 3.1.
generate_file_id() → bytesสร้างรหัสไฟล์ขนาด 16 ไบต์แบบสุ่มสำหรับเอกสารใหม่.

ดูเพิ่มเติม

 ภาษาไทย