EncryptionUtils
EncryptionUtils
Panoramica
EncryptionUtils è una classe in Aspose.PDF FOSS per Python.
Classe di utilità per AES-CBC conforme a PDF, crittografia RC4 e derivazione della chiave.
Questa classe fornisce 15 metodi per lavorare con oggetti EncryptionUtils nei programmi Python. I metodi disponibili includono: 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 e 3 metodi aggiuntivi. Tutti i membri pubblici sono accessibili a qualsiasi applicazione Python dopo aver installato il pacchetto Aspose.PDF FOSS per Python.
Metodi
| Firma | Descrizione |
|---|---|
| `encrypt_aes_cbc(key: bytes, data: bytes, iv: bytes | None)→bytes` |
decrypt_aes_cbc(key: bytes, data: bytes) → bytes | Decifra i dati cifrati da encrypt_aes_cbc. |
encrypt_rc4(key: bytes, data: bytes) → bytes | Cifra i dati utilizzando l’algoritmo RC4 (ARC4). |
decrypt_rc4(key: bytes, data: bytes) → bytes | Decifra i dati utilizzando l’algoritmo RC4 (ARC4). |
decrypt_writer_encrypted_stream(file_key: bytes, algorithm: str, obj_id: int, data: bytes) → bytes | Decripta i byte del flusso prodotti da :meth:PdfWriterV0._encrypt_data. |
compute_owner_key_v4(owner_password: str, user_password: str, key_length: int, revision: int) → bytes | Calcola il valore della password del proprietario (O) secondo l’Algoritmo 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 | Calcola la chiave di cifratura del file secondo l’Algoritmo 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] | Calcola il valore della password dell’utente (U) e la chiave di cifratura secondo gli Algoritmi 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 | Calcola l’hash per V5/R6 secondo l’Algoritmo 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 | Cifra le autorizzazioni e il flag dei metadati per R6. |
derive_object_key(file_key: bytes, obj_num: int, gen_num: int, use_aes: bool) → bytes | Deriva la chiave specifica per l’oggetto secondo Algorithm 3.1. |
generate_file_id() → bytes | Genera un ID file casuale di 16 byte per i nuovi documenti. |