EncryptionUtils
EncryptionUtils
نمای کلی
EncryptionUtils یک کلاس در Aspose.PDF FOSS برای Python است.
کلاس ابزار برای AES-CBC سازگار با PDF، رمزنگاری RC4، و استخراج کلید.
این کلاس 15 متد برای کار با اشیاء EncryptionUtils در برنامههای 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 متد اضافی هستند. تمام اعضای عمومی پس از نصب بسته Aspose.PDF FOSS برای Python، برای هر برنامه 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 | مقدار رمز عبور مالک (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) → `bytes | None` |
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: 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 | کلید مخصوص شیء را بر حسب الگوریتم 3.1 استخراج کنید. |
generate_file_id() → bytes | یک شناسه فایل تصادفی 16 بایتی برای اسناد جدید تولید کنید. |