EncryptionUtils
개요
EncryptionUtils은 Aspose.PDF FOSS에서 Python용 클래스입니다.
PDF 호환 AES-CBC, RC4 암호화 및 키 파생을 위한 유틸리티 클래스.
이 클래스는 Python 프로그램에서 EncryptionUtils 객체를 다루기 위한 15개의 메서드를 제공합니다. 사용 가능한 메서드에는 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 멤버는 Aspose.PDF FOSS for Python 패키지를 설치한 후 any Python 애플리케이션에서 접근할 수 있습니다.
메서드
| 시그니처 | 설명 |
|---|---|
| `encrypt_aes_cbc(key: bytes, data: bytes, iv: bytes | None)→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 | 알고리즘 3.3에 따라 소유자 비밀번호 값(O)을 계산합니다. |
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] | Algorithm 3.4/3.5에 따라 사용자 비밀번호 값(U) 및 암호화 키를 계산합니다. |
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) → `bytes | None` |
compute_hash_v5(password: bytes, salt: bytes, user_key: bytes) → bytes | Algorithm 2.B (ISO 32000-2)에 따라 V5/R6의 해시를 계산합니다. |
| `compute_user_owner_keys_v6(user_password: str, owner_password: str, file_key: bytes | None)→tuple[bytes, bytes, bytes, bytes]` |
verify_password_v6(password: str, u_value: bytes, o_value: bytes, ue_value: bytes, oe_value: bytes) → `bytes | None` |
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 | Algorithm 3.1에 따라 객체별 키를 파생합니다. |
generate_file_id() → bytes | 새 문서에 대한 무작위 16바이트 파일 ID를 생성합니다. |