EncryptionUtils

EncryptionUtils

Tổng quan

EncryptionUtils là một lớp trong Aspose.PDF FOSS cho Python.

Lớp tiện ích cho AES-CBC tuân thủ PDF, mã hóa RC4, và suy xuất khóa.

Lớp này cung cấp 15 phương thức để làm việc với các đối tượng EncryptionUtils trong các chương trình Python. Các phương thức khả dụng bao gồm: 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, và 3 phương thức bổ sung. Tất cả các thành viên công khai đều có thể truy cập bởi bất kỳ ứng dụng Python nào sau khi cài đặt gói Aspose.PDF FOSS cho Python.

Phương thức

Chữ kýMô tả
`encrypt_aes_cbc(key: bytes, data: bytes, iv: bytesNone)→bytes`
decrypt_aes_cbc(key: bytes, data: bytes) → bytesGiải mã dữ liệu đã được mã hóa bằng encrypt_aes_cbc.
encrypt_rc4(key: bytes, data: bytes) → bytesMã hóa dữ liệu bằng thuật toán RC4 (ARC4).
decrypt_rc4(key: bytes, data: bytes) → bytesGiải mã dữ liệu bằng thuật toán RC4 (ARC4).
decrypt_writer_encrypted_stream(file_key: bytes, algorithm: str, obj_id: int, data: bytes) → bytesGiải mã các byte luồng được tạo bởi :meth:PdfWriterV0._encrypt_data.
compute_owner_key_v4(owner_password: str, user_password: str, key_length: int, revision: int) → bytesTính giá trị mật khẩu Chủ sở hữu (O) theo Thuật toán 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) → bytesTính khóa mã hóa tệp theo Thuật toán 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]Tính giá trị mật khẩu Người dùng (U) và khóa mã hóa theo Thuật toán 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) → bytesTính toán hàm băm cho V5/R6 theo Thuật toán 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) → bytesMã hoá quyền và cờ siêu dữ liệu cho R6.
derive_object_key(file_key: bytes, obj_num: int, gen_num: int, use_aes: bool) → bytesSuy ra khóa riêng cho đối tượng theo Thuật toán 3.1.
generate_file_id() → bytesTạo một ID tệp ngẫu nhiên 16 byte cho các tài liệu mới.

Xem thêm

 Tiếng Việt