public class PublicKeySecurityHandler extends SecurityHandler
to see how to protect document with this security handler.
Modifier and Type | Field and Description |
---|---|
static String |
FILTER
The filter name.
|
currentAccessPermission, decryptMetadata, document, encryptionKey, keyLength, rc4, version
Constructor and Description |
---|
PublicKeySecurityHandler()
Constructor.
|
PublicKeySecurityHandler(PublicKeyProtectionPolicy p)
Constructor used for encryption.
|
Modifier and Type | Method and Description |
---|---|
void |
decryptDocument(PDDocument doc,
DecryptionMaterial decryptionMaterial)
Decrypt the document.
|
boolean |
hasProtectionPolicy()
Returns whether a protection policy has been set.
|
void |
prepareDocumentForEncryption(PDDocument doc)
Prepare the document for encryption.
|
void |
prepareForDecryption(PDEncryptionDictionary encDictionary,
COSArray documentIDArray,
DecryptionMaterial decryptionMaterial)
Prepares everything to decrypt the document.
|
decryptArray, decryptStream, decryptString, encryptData, encryptData, encryptStream, encryptString, getCurrentAccessPermission, getKeyLength, isAES, proceedDecryption, setAES, setKeyLength
public static final String FILTER
public PublicKeySecurityHandler()
public PublicKeySecurityHandler(PublicKeyProtectionPolicy p)
p
- The protection policy.public void decryptDocument(PDDocument doc, DecryptionMaterial decryptionMaterial) throws CryptographyException, IOException
decryptDocument
in class SecurityHandler
doc
- The document to decrypt.decryptionMaterial
- The data used to decrypt the document.CryptographyException
- If there is an error during decryption.IOException
- If there is an error accessing data.public void prepareForDecryption(PDEncryptionDictionary encDictionary, COSArray documentIDArray, DecryptionMaterial decryptionMaterial) throws CryptographyException, IOException
decryptDocument(PDDocument, DecryptionMaterial)
is used, this method is
called from there. Only if decryption of single objects is needed this should be called instead.prepareForDecryption
in class SecurityHandler
encDictionary
- encryption dictionary, can be retrieved via PDDocument.getEncryptionDictionary()
documentIDArray
- document id which is returned via COSDocument.getDocumentID()
(not used by this handler)decryptionMaterial
- Information used to decrypt the document.IOException
- If there is an error accessing data.CryptographyException
- If there is an error with decryption.public void prepareDocumentForEncryption(PDDocument doc) throws CryptographyException
prepareDocumentForEncryption
in class SecurityHandler
doc
- The document that will be encrypted.CryptographyException
- If there is an error while encrypting.public boolean hasProtectionPolicy()
hasProtectionPolicy
in class SecurityHandler
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.