T_POLICY
- the protection policy.public abstract class SecurityHandler<T_POLICY extends ProtectionPolicy> extends Object
Modifier and Type | Method and Description |
---|---|
byte[] |
decryptBuffer(long objectNumber,
long genNumber,
byte[] bytes) |
AccessPermission |
getCurrentAccessPermission()
Returns the access permissions that were computed during document decryption.
|
byte[] |
getEncryptionKey()
Returns the current encryption key data.
|
int |
getKeyLength()
Getter of the property keyLength.
|
boolean |
hasProtectionPolicy()
Returns whether a protection policy has been set.
|
boolean |
isAES()
True if AES is used for encryption and decryption.
|
boolean |
isDecryptMetadata()
Returns true if meta data is to be decrypted.
|
abstract void |
prepareDocumentForEncryption(PDEncryption encryptionDictionary,
byte[] documentID)
Prepare the document for encryption.
|
abstract void |
prepareForDecryption(PDEncryption encryption,
byte[] documentIDBytes,
DecryptionMaterial decryptionMaterial)
Prepares everything to decrypt the document.
|
void |
setAES(boolean aesValue)
Set to true if AES for encryption and decryption should be used.
|
void |
setCurrentAccessPermission(AccessPermission currentAccessPermission)
Sets the access permissions.
|
void |
setCustomSecureRandom(SecureRandom customSecureRandom)
Set the custom SecureRandom.
|
void |
setEncryptionKey(byte[] encryptionKey)
Sets the current encryption key data.
|
void |
setKeyLength(int keyLen)
Setter of the property keyLength.
|
void |
setParams(boolean encrypt,
T_POLICY protectionPolicy,
PDEncryption encryptionDict,
byte[] fingerprint,
String password) |
public void setParams(boolean encrypt, T_POLICY protectionPolicy, PDEncryption encryptionDict, byte[] fingerprint, String password) throws IOException
IOException
public boolean isDecryptMetadata()
public void setCustomSecureRandom(SecureRandom customSecureRandom)
customSecureRandom
- the custom SecureRandom for AES encryptionpublic abstract void prepareDocumentForEncryption(PDEncryption encryptionDictionary, byte[] documentID) throws IOException
encryptionDictionary
- encryption dictionarydocumentID
- document ID bytesIOException
- If there is an error with the document.public abstract void prepareForDecryption(PDEncryption encryption, byte[] documentIDBytes, DecryptionMaterial decryptionMaterial) throws IOException
encryption
- encryption dictionarydocumentIDBytes
- document id bytesdecryptionMaterial
- Information used to decrypt the document.InvalidPasswordException
- If the password is incorrect.IOException
- If there is an error accessing data.public byte[] decryptBuffer(long objectNumber, long genNumber, byte[] bytes) throws CryptographyException, IOException
CryptographyException
IOException
public int getKeyLength()
public void setKeyLength(int keyLen)
keyLen
- The keyLength to set.public void setCurrentAccessPermission(AccessPermission currentAccessPermission)
currentAccessPermission
- The access permissions to be set.public AccessPermission getCurrentAccessPermission()
public boolean isAES()
public void setAES(boolean aesValue)
aesValue
- if true AES will be usedpublic boolean hasProtectionPolicy()
public byte[] getEncryptionKey()
public void setEncryptionKey(byte[] encryptionKey)
encryptionKey
- The encryption key data to set.Revision 4.1.0 / 20211203-0554