The class implements the standard security handler as decribed
in the PDF specifications. This security handler protects document
with password.
computeEncryptedKey
public final byte[] computeEncryptedKey(byte[] password,
byte[] o,
int permissions,
byte[] id,
int encRevision,
int length)
throws CryptographyException
Compute the encryption key.
password
- The password to compute the encrypted key.o
- The o entry of the encryption dictionary.permissions
- The permissions for the document.id
- The document id.encRevision
- The revision of the encryption algorithm.length
- The length of the encryption key.
computeOwnerPassword
public final byte[] computeOwnerPassword(byte[] ownerPassword,
byte[] userPassword,
int encRevision,
int length)
throws CryptographyException,
IOException
Compute the owner entry in the encryption dictionary.
ownerPassword
- The plaintext owner password.userPassword
- The plaintext user password.encRevision
- The revision number of the encryption algorithm.length
- The length of the encryption key.
- The o entry of the encryption dictionary.
computeUserPassword
public final byte[] computeUserPassword(byte[] password,
byte[] o,
int permissions,
byte[] id,
int encRevision,
int length)
throws CryptographyException,
IOException
This will compute the user password hash.
password
- The plain text password.o
- The owner password hash.permissions
- The document permissions.id
- The document id.encRevision
- The revision of the encryption.length
- The length of the encryption key.
getUserPassword
public final byte[] getUserPassword(byte[] ownerPassword,
byte[] o,
int encRevision,
long length)
throws CryptographyException,
IOException
Get the user password based on the owner password.
ownerPassword
- The plaintext owner password.o
- The o entry of the encryption dictionary.encRevision
- The encryption revision number.length
- The key length.
- The u entry of the encryption dictionary.
isOwnerPassword
public final boolean isOwnerPassword(byte[] ownerPassword,
byte[] u,
byte[] o,
int permissions,
byte[] id,
int encRevision,
int length)
throws CryptographyException,
IOException
Check for owner password.
ownerPassword
- The owner password.u
- The u entry of the encryption dictionary.o
- The o entry of the encryption dictionary.permissions
- The set of permissions on the document.id
- The document id.encRevision
- The encryption algorithm revision.length
- The encryption key length.
- True If the ownerPassword param is the owner password.
isUserPassword
public final boolean isUserPassword(byte[] password,
byte[] u,
byte[] o,
int permissions,
byte[] id,
int encRevision,
int length)
throws CryptographyException,
IOException
Check if a plaintext password is the user password.
password
- The plaintext password.u
- The u entry of the encryption dictionary.o
- The o entry of the encryption dictionary.permissions
- The permissions set in the the PDF.id
- The document id used for encryption.encRevision
- The revision of the encryption algorithm.length
- The length of the encryption key.
- true If the plaintext password is the user password.