public final class StandardSecurityHandler extends SecurityHandler
to see how to protect document with this security handler.| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
FILTER |
Type of security handler.
|
static java.lang.Class<?> |
PROTECTION_POLICY_CLASS |
Protection policy class for this handler.
|
encryptionKey, keyLength| Constructor | Description |
|---|---|
StandardSecurityHandler() |
Constructor.
|
StandardSecurityHandler(StandardProtectionPolicy p) |
Constructor used for encryption.
|
| Modifier and Type | Method | Description |
|---|---|---|
byte[] |
computeEncryptedKey(byte[] password,
byte[] o,
byte[] u,
byte[] oe,
byte[] ue,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata,
boolean isOwnerPassword) |
Compute the encryption key.
|
byte[] |
computeOwnerPassword(byte[] ownerPassword,
byte[] userPassword,
int encRevision,
int length) |
Compute the owner entry in the encryption dictionary.
|
byte[] |
computeUserPassword(byte[] password,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata) |
This will compute the user password hash.
|
byte[] |
getUserPassword(byte[] ownerPassword,
byte[] owner,
int encRevision,
int length) |
Get the user password based on the owner password.
|
boolean |
hasProtectionPolicy() |
Returns whether a protection policy has been set.
|
boolean |
isOwnerPassword(byte[] ownerPassword,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata) |
Check for owner password.
|
boolean |
isOwnerPassword(java.lang.String password,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata) |
Check for owner password.
|
boolean |
isUserPassword(byte[] password,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata) |
Check if a plaintext password is the user password.
|
boolean |
isUserPassword(java.lang.String password,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata) |
Check if a plaintext password is the user password.
|
void |
prepareDocumentForEncryption(PDDocument document) |
Prepare document for encryption.
|
void |
prepareForDecryption(PDEncryption encryption,
COSArray documentIDArray,
DecryptionMaterial decryptionMaterial) |
Prepares everything to decrypt the document.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecrypt, decryptStream, encryptDataRC4, encryptDataRC4, encryptStream, encryptString, getCurrentAccessPermission, getKeyLength, isAES, setAES, setCurrentAccessPermission, setDecryptMetadata, setKeyLengthpublic static final java.lang.String FILTER
public static final java.lang.Class<?> PROTECTION_POLICY_CLASS
public StandardSecurityHandler()
public StandardSecurityHandler(StandardProtectionPolicy p)
p - The protection policy.public void prepareForDecryption(PDEncryption encryption, COSArray documentIDArray, DecryptionMaterial decryptionMaterial) throws InvalidPasswordException, java.io.IOException
prepareForDecryption in class SecurityHandlerencryption - encryption dictionarydocumentIDArray - document iddecryptionMaterial - Information used to decrypt the document.InvalidPasswordException - If the password is incorrect.java.io.IOException - If there is an error accessing data.public void prepareDocumentForEncryption(PDDocument document) throws java.io.IOException
prepareDocumentForEncryption in class SecurityHandlerdocument - The documenet to encrypt.java.io.IOException - If there is an error accessing data.public boolean isOwnerPassword(byte[] ownerPassword,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata)
throws java.io.IOException
ownerPassword - The owner password.user - The u entry of the encryption dictionary.owner - The o entry of the encryption dictionary.permissions - The set of permissions on the document.id - The document id.encRevision - The encryption algorithm revision.keyLengthInBytes - The encryption key length in bytes.encryptMetadata - The encryption metadatajava.io.IOException - If there is an error accessing data.public byte[] getUserPassword(byte[] ownerPassword,
byte[] owner,
int encRevision,
int length)
throws java.io.IOException
ownerPassword - The plaintext owner password.owner - The o entry of the encryption dictionary.encRevision - The encryption revision number.length - The key length.java.io.IOException - If there is an error accessing data while generating the user password.public byte[] computeEncryptedKey(byte[] password,
byte[] o,
byte[] u,
byte[] oe,
byte[] ue,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata,
boolean isOwnerPassword)
throws java.io.IOException
password - The password to compute the encrypted key.o - The O entry of the encryption dictionary.u - The U entry of the encryption dictionary.oe - The OE entry of the encryption dictionary.ue - The UE entry of the encryption dictionary.permissions - The permissions for the document.id - The document id.encRevision - The revision of the encryption algorithm.keyLengthInBytes - The length of the encryption key in bytes.encryptMetadata - The encryption metadataisOwnerPassword - whether the password given is the owner password (for revision 6)java.io.IOException - If there is an error with encryption.public byte[] computeUserPassword(byte[] password,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata)
throws java.io.IOException
password - The plain text password.owner - The owner password hash.permissions - The document permissions.id - The document id.encRevision - The revision of the encryption.keyLengthInBytes - The length of the encryption key in bytes.encryptMetadata - The encryption metadatajava.io.IOException - if the password could not be computedpublic byte[] computeOwnerPassword(byte[] ownerPassword,
byte[] userPassword,
int encRevision,
int length)
throws java.io.IOException
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.java.io.IOException - if the owner password could not be computedpublic boolean isUserPassword(byte[] password,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata)
throws java.io.IOException
password - The plaintext password.user - The u entry of the encryption dictionary.owner - The o entry of the encryption dictionary.permissions - The permissions set in the PDF.id - The document id used for encryption.encRevision - The revision of the encryption algorithm.keyLengthInBytes - The length of the encryption key in bytes.encryptMetadata - The encryption metadata.java.io.IOException - If there is an error accessing data.public boolean isUserPassword(java.lang.String password,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata)
throws java.io.IOException
password - The plaintext password.user - The u entry of the encryption dictionary.owner - The o entry of the encryption dictionary.permissions - The permissions set in the PDF.id - The document id used for encryption.encRevision - The revision of the encryption algorithm.keyLengthInBytes - The length of the encryption key in bytes.encryptMetadata - The encryption metadatajava.io.IOException - If there is an error accessing data.public boolean isOwnerPassword(java.lang.String password,
byte[] user,
byte[] owner,
int permissions,
byte[] id,
int encRevision,
int keyLengthInBytes,
boolean encryptMetadata)
throws java.io.IOException
password - The owner password.user - The u entry of the encryption dictionary.owner - The o entry of the encryption dictionary.permissions - The set of permissions on the document.id - The document id.encRevision - The encryption algorithm revision.keyLengthInBytes - The encryption key length in bytes.encryptMetadata - The encryption metadatajava.io.IOException - If there is an error accessing data.public boolean hasProtectionPolicy()
hasProtectionPolicy in class SecurityHandlerCopyright © 2002–2018. All rights reserved.