PDFKeyDerivation
Overview
PDFKeyDerivation is a class in Aspose.PDF FOSS for Java.
PDF encryption key derivation algorithms.
This class provides 11 methods for working with PDFKeyDerivation objects in Java programs.
Available methods include: computeEncryptionKeyR2R4, computeEncryptionKeyR5Owner, computeEncryptionKeyR5User, computeEncryptionKeyR6Owner, computeEncryptionKeyR6User, computeHashR5, computeHashR6, generateO_R2R4, generateU_R2, generateU_R3R4, padPassword.
All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package.
Properties: PADDING.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
PADDING | byte[] | Read | The 32-byte padding string from Algorithm 2 step (a). |
Methods
| Signature | Description |
|---|---|
computeEncryptionKeyR2R4(password: byte[], encDict: PDFEncryptionDict, documentId: byte[]) → byte[] | Algorithm 2: Compute encryption key for R2-R4. |
computeEncryptionKeyR6User(password: byte[], encDict: PDFEncryptionDict) → byte[] | Compute encryption key for R=5/R=6 (AES-256). |
computeEncryptionKeyR6Owner(password: byte[], encDict: PDFEncryptionDict) → byte[] | Compute encryption key for R=6 via owner password. |
computeHashR5(password: byte[], salt: byte[], userKey: byte[]) → byte[] | R=5 (Adobe Extension Level 3) hash: a single SHA-256 of |
| {@code password + salt [+ userKey]}, with NO Algorithm 2.B iteration. | |
computeEncryptionKeyR5User(password: byte[], encDict: PDFEncryptionDict) → byte[] | Compute the file encryption key for R=5 via the user password |
| (Adobe Extension Level 3 — single SHA-256, no iteration). | |
computeEncryptionKeyR5Owner(password: byte[], encDict: PDFEncryptionDict) → byte[] | Compute the file encryption key for R=5 via the owner password |
| (Adobe Extension Level 3 — single SHA-256, no iteration). | |
generateO_R2R4(ownerPassword: byte[], userPassword: byte[], keyLenBytes: int, R: int) → byte[] | Algorithm 3 (ISO 32000-1:2008, §7.6.3.4): computes the /O (owner) hash. |
generateU_R2(encryptionKey: byte[]) → byte[] | Algorithm 4 (ISO 32000-1:2008, §7.6.3.4): computes the /U hash for R=2. |
generateU_R3R4(encryptionKey: byte[], documentId: byte[]) → byte[] | Algorithm 5 (ISO 32000-1:2008, §7.6.3.4): computes the /U hash for R=3/4. |
padPassword(password: byte[]) → byte[] | Pads or truncates a password to exactly 32 bytes. |
computeHashR6(password: byte[], salt: byte[], userKey: byte[]) → byte[] | Computes the R=6 validation or key-derivation hash (ISO 32000-2, Algorithm 2.B). |