| Modifier and Type | Field and Description |
|---|---|
| private static final byte[] | |
| private AccessPermission | currentAccessPermission
The access permission granted to the current user for the document. |
| private SecureRandom | customSecureRandom
Can be used to allow stateless AES encryption |
| private boolean | decryptMetadata
Indicates if the Metadata have to be decrypted of not. |
| private static final short | |
| private byte[] | encryptionKey
The encryption key that will be used to encrypt / decrypt. |
| private short | keyLength
The length in bits of the secret key used to encrypt the document. |
| private static final Log | |
| private final Set | |
| private T_POLICY | protectionPolicy
The typed |
| private final RC4Cipher | rc4
The RC4 implementation used for cryptographic functions. |
| private COSName | streamFilterName
The stream filter name. |
| private COSName | stringFilterName
The string filter name. |
| private boolean |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private byte[] | Returns: the calculated key.The data object number. objectNumber, long The data generation number. genNumber)Calculate the key to be used for RC4 and AES-128. |
| protected int | Returns: The computed version number.Computes the version number of the |
| private Cipher | |
| public void | |
| private void | decryptArray(COSArray
The array to decrypt. array, long The object number. objNum, long The object generation number. genNum)This will decrypt an array. |
| private void | decryptDictionary(COSDictionary
The dictionary to decrypt. dictionary, long The object number. objNum, long The object generation number. genNum)This will decrypt a dictionary. |
| public void | decryptStream(COSStream
The stream to decrypt. stream, long The object number. objNum, long The object generation number. genNum)This will decrypt a stream. |
| private void | decryptString(COSString
the string to decrypt. string, long The object number. objNum, long The object generation number. genNum)This will decrypt a string. |
| private void | encryptData(long
The data object number. objectNumber, long The data generation number. genNumber, InputStream The data to encrypt. data, OutputStream The output to write the encrypted data to. output, boolean true to decrypt the data, false to encrypt it. decrypt)Encrypt or decrypt a set of data. |
| private void | encryptDataAES256(InputStream
The data to encrypt. data, OutputStream The output to write the encrypted data to. output, boolean true to decrypt the data, false to encrypt it. decrypt)Encrypt or decrypt data with AES256. |
| private void | encryptDataAESother(byte[]
The final key obtained with via finalKey, InputStream calcFinalKey(long, long).The data to encrypt. data, OutputStream The output to write the encrypted data to. output, boolean true to decrypt the data, false to encrypt it. decrypt)Encrypt or decrypt data with AES with key length other than 256 bits. |
| protected void | encryptDataRC4(byte[]
The final key obtained with via finalKey, InputStream calcFinalKey(long, long).The data to encrypt. input, OutputStream The output to write the encrypted data to. output)Encrypt or decrypt data with RC4. |
| protected void | encryptDataRC4(byte[]
The final key obtained with via finalKey, byte[] calcFinalKey(long, long).The data to encrypt. input, OutputStream The output to write the encrypted data to. output)Encrypt or decrypt data with RC4. |
| public void | encryptStream(COSStream
The stream to decrypt. stream, long The object number. objNum, int The object generation number. genNum)This will encrypt a stream, but not the dictionary as the dictionary is encrypted by visitFromString() in COSWriter and we don't want to encrypt it twice. |
| public void | encryptString(COSString
the string to encrypt. string, long The object number. objNum, int The object generation number. genNum)This will encrypt a string. |
| public AccessPermission | Returns: the access permissions or null if the document was not decrypted.Returns the access permissions that were computed during document decryption. |
| public byte[] | |
| public int | |
| protected T_POLICY | |
| private SecureRandom | Returns: SecureRandomReturns a SecureRandom If customSecureRandom is not defined, instantiate a new SecureRandom |
| public boolean | Returns: true if a protection policy has been set.Returns whether a protection policy has been set. |
| public boolean | |
| public boolean | Returns: True if meta data has to be decrypted.Returns true if meta data is to be decrypted. |
| private boolean | |
| public abstract void | prepareDocumentForEncryption(PDDocument
The document that will be encrypted. doc)Prepare the document for encryption. |
| public abstract void | prepareForDecryption(PDEncryption
encryption dictionary, can be retrieved via encryption, COSArray PDDocument#getEncryption()document id which is returned via documentIDArray, DecryptionMaterial org.Information used to decrypt the document. decryptionMaterial)Prepares everything to decrypt the document. |
| public void | setAES(boolean
if true AES will be used aesValue)Set to true if AES for encryption and decryption should be used. |
| public void | setCurrentAccessPermission(AccessPermission
The access permissions to be set. currentAccessPermission)Sets the access permissions. |
| public void | setCustomSecureRandom(SecureRandom
the custom SecureRandom for AES encryption customSecureRandom)Set the custom SecureRandom. |
| protected void | setDecryptMetadata(boolean
true if meta data has to be decrypted. decryptMetadata)Set whether to decrypt meta data. |
| public void | setEncryptionKey(byte[]
The encryption key data to set. encryptionKey)Sets the current encryption key data. |
| public void | |
| protected void | setProtectionPolicy(T_POLICY
The protectionPolicy)ProtectionPolicy, that shall be set.Sets the |
| protected void | |
| protected void |
| AES_SALT | back to summary |
|---|---|
| private static final byte[] AES_SALT | |
| currentAccessPermission | back to summary |
|---|---|
| private AccessPermission currentAccessPermission The access permission granted to the current user for the document. These permissions are computed during decryption and are in read only mode. | |
| customSecureRandom | back to summary |
|---|---|
| private SecureRandom customSecureRandom Can be used to allow stateless AES encryption | |
| decryptMetadata | back to summary |
|---|---|
| private boolean decryptMetadata Indicates if the Metadata have to be decrypted of not. | |
| DEFAULT_KEY_LENGTH | back to summary |
|---|---|
| private static final short DEFAULT_KEY_LENGTH | |
| encryptionKey | back to summary |
|---|---|
| private byte[] encryptionKey The encryption key that will be used to encrypt / decrypt. | |
| keyLength | back to summary |
|---|---|
| private short keyLength The length in bits of the secret key used to encrypt the document. | |
| LOG | back to summary |
|---|---|
| private static final Log LOG | |
| objects | back to summary |
|---|---|
| private final Set<COSBase> objects | |
| protectionPolicy | back to summary |
|---|---|
| private T_POLICY protectionPolicy The typed | |
| rc4 | back to summary |
|---|---|
| private final RC4Cipher rc4 The RC4 implementation used for cryptographic functions. | |
| streamFilterName | back to summary |
|---|---|
| private COSName streamFilterName The stream filter name. | |
| stringFilterName | back to summary |
|---|---|
| private COSName stringFilterName The string filter name. | |
| useAES | back to summary |
|---|---|
| private boolean useAES | |
| SecurityHandler | back to summary |
|---|---|
| protected SecurityHandler() Constructor. | |
| SecurityHandler | back to summary |
|---|---|
| protected SecurityHandler(T_POLICY protectionPolicy) Constructor used for encryption.
| |
| calcFinalKey | back to summary |
|---|---|
| private byte[] calcFinalKey(long objectNumber, long genNumber) Calculate the key to be used for RC4 and AES-128.
| |
| computeVersionNumber | back to summary |
|---|---|
| protected int computeVersionNumber() Computes the version number of the
| |
| createCipher | back to summary |
|---|---|
| private Cipher createCipher(byte[] key, byte[] iv, boolean decrypt) throws GeneralSecurityException | |
| decrypt | back to summary |
|---|---|
| public void decrypt(COSBase obj, long objNum, long genNum) throws IOException This will dispatch to the correct method.
| |
| decryptArray | back to summary |
|---|---|
| private void decryptArray(COSArray array, long objNum, long genNum) throws IOException This will decrypt an array.
| |
| decryptDictionary | back to summary |
|---|---|
| private void decryptDictionary(COSDictionary dictionary, long objNum, long genNum) throws IOException This will decrypt a dictionary.
| |
| decryptStream | back to summary |
|---|---|
| public void decryptStream(COSStream stream, long objNum, long genNum) throws IOException This will decrypt a stream.
| |
| decryptString | back to summary |
|---|---|
| private void decryptString(COSString string, long objNum, long genNum) This will decrypt a string.
| |
| encryptData | back to summary |
|---|---|
| private void encryptData(long objectNumber, long genNumber, InputStream data, OutputStream output, boolean decrypt) throws IOException Encrypt or decrypt a set of data.
| |
| encryptDataAES256 | back to summary |
|---|---|
| private void encryptDataAES256(InputStream data, OutputStream output, boolean decrypt) throws IOException Encrypt or decrypt data with AES256.
| |
| encryptDataAESother | back to summary |
|---|---|
| private void encryptDataAESother(byte[] finalKey, InputStream data, OutputStream output, boolean decrypt) throws IOException Encrypt or decrypt data with AES with key length other than 256 bits.
| |
| encryptDataRC4 | back to summary |
|---|---|
| protected void encryptDataRC4(byte[] finalKey, InputStream input, OutputStream output) throws IOException Encrypt or decrypt data with RC4.
| |
| encryptDataRC4 | back to summary |
|---|---|
| protected void encryptDataRC4(byte[] finalKey, byte[] input, OutputStream output) throws IOException Encrypt or decrypt data with RC4.
| |
| encryptStream | back to summary |
|---|---|
| public void encryptStream(COSStream stream, long objNum, int genNum) throws IOException This will encrypt a stream, but not the dictionary as the dictionary is encrypted by visitFromString() in COSWriter and we don't want to encrypt it twice.
| |
| encryptString | back to summary |
|---|---|
| public void encryptString(COSString string, long objNum, int genNum) throws IOException This will encrypt a string.
| |
| getCurrentAccessPermission | back to summary |
|---|---|
| public AccessPermission getCurrentAccessPermission() Returns the access permissions that were computed during document decryption. The returned object is in read only mode.
| |
| getEncryptionKey | back to summary |
|---|---|
| public byte[] getEncryptionKey() Returns the current encryption key data.
| |
| getKeyLength | back to summary |
|---|---|
| public int getKeyLength() Getter of the property keyLength.
| |
| getProtectionPolicy | back to summary |
|---|---|
| protected T_POLICY getProtectionPolicy() Returns the set
| |
| getSecureRandom | back to summary |
|---|---|
| private SecureRandom getSecureRandom() Returns a SecureRandom If customSecureRandom is not defined, instantiate a new SecureRandom
| |
| hasProtectionPolicy | back to summary |
|---|---|
| public boolean hasProtectionPolicy() Returns whether a protection policy has been set.
| |
| isAES | back to summary |
|---|---|
| public boolean isAES() True if AES is used for encryption and decryption.
| |
| isDecryptMetadata | back to summary |
|---|---|
| public boolean isDecryptMetadata() Returns true if meta data is to be decrypted.
| |
| prepareAESInitializationVector | back to summary |
|---|---|
| private boolean prepareAESInitializationVector(boolean decrypt, byte[] iv, InputStream data, OutputStream output) throws IOException | |
| prepareDocumentForEncryption | back to summary |
|---|---|
| public abstract void prepareDocumentForEncryption(PDDocument doc) throws IOException Prepare the document for encryption.
| |
| prepareForDecryption | back to summary |
|---|---|
| public abstract void prepareForDecryption(PDEncryption encryption, COSArray documentIDArray, DecryptionMaterial decryptionMaterial) throws IOException Prepares everything to decrypt the document.
| |
| setAES | back to summary |
|---|---|
| public void setAES(boolean aesValue) Set to true if AES for encryption and decryption should be used.
| |
| setCurrentAccessPermission | back to summary |
|---|---|
| public void setCurrentAccessPermission(AccessPermission currentAccessPermission) Sets the access permissions.
| |
| setCustomSecureRandom | back to summary |
|---|---|
| public void setCustomSecureRandom(SecureRandom customSecureRandom) Set the custom SecureRandom.
| |
| setDecryptMetadata | back to summary |
|---|---|
| protected void setDecryptMetadata(boolean decryptMetadata) Set whether to decrypt meta data.
| |
| setEncryptionKey | back to summary |
|---|---|
| public void setEncryptionKey(byte[] encryptionKey) Sets the current encryption key data.
| |
| setKeyLength | back to summary |
|---|---|
| public void setKeyLength(int keyLen) Setter of the property keyLength.
| |
| setProtectionPolicy | back to summary |
|---|---|
| protected void setProtectionPolicy(T_POLICY protectionPolicy) Sets the
| |
| setStreamFilterName | back to summary |
|---|---|
| protected void setStreamFilterName(COSName streamFilterName) Set the stream filter name.
| |
| setStringFilterName | back to summary |
|---|---|
| protected void setStringFilterName(COSName stringFilterName) Set the string filter name.
| |