Package com.pd4ml.pdf.encryption
Class PublicKeySecurityHandler
- java.lang.Object
-
- com.pd4ml.pdf.encryption.SecurityHandler<PublicKeyProtectionPolicy>
-
- com.pd4ml.pdf.encryption.PublicKeySecurityHandler
-
public final class PublicKeySecurityHandler extends SecurityHandler<PublicKeyProtectionPolicy>
This class implements the public key security handler described in the PDF specification.- Author:
- Benoit Guillon
- See Also:
to see how to protect document with this security handler.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FILTER
The filter name.
-
Constructor Summary
Constructors Constructor Description PublicKeySecurityHandler()
Constructor.PublicKeySecurityHandler(PublicKeyProtectionPolicy publicKeyProtectionPolicy)
Constructor used for encryption.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
prepareDocumentForEncryption(PDEncryption dictionary, byte[] documentID)
Prepare the document for encryption.void
prepareForDecryption(PDEncryption encryption, byte[] documentIDBytes, DecryptionMaterial decryptionMaterial)
Prepares everything to decrypt the document.-
Methods inherited from class com.pd4ml.pdf.encryption.SecurityHandler
decryptBuffer, getCurrentAccessPermission, getEncryptionKey, getKeyLength, hasProtectionPolicy, isAES, isDecryptMetadata, setAES, setCurrentAccessPermission, setCustomSecureRandom, setEncryptionKey, setKeyLength, setParams
-
-
-
-
Field Detail
-
FILTER
public static final java.lang.String FILTER
The filter name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PublicKeySecurityHandler
public PublicKeySecurityHandler()
Constructor.
-
PublicKeySecurityHandler
public PublicKeySecurityHandler(PublicKeyProtectionPolicy publicKeyProtectionPolicy)
Constructor used for encryption.- Parameters:
publicKeyProtectionPolicy
- The protection policy.
-
-
Method Detail
-
prepareForDecryption
public void prepareForDecryption(PDEncryption encryption, byte[] documentIDBytes, DecryptionMaterial decryptionMaterial) throws java.io.IOException
Prepares everything to decrypt the document.- Specified by:
prepareForDecryption
in classSecurityHandler<PublicKeyProtectionPolicy>
- Parameters:
encryption
- encryption dictionarydocumentIDBytes
- document id bytes (not used by this handler)decryptionMaterial
- Information used to decrypt the document.- Throws:
java.io.IOException
- If there is an error accessing data. If verbose mode is enabled, the exception message will provide more details why the match wasn't successful.
-
prepareDocumentForEncryption
public void prepareDocumentForEncryption(PDEncryption dictionary, byte[] documentID) throws java.io.IOException
Prepare the document for encryption.- Specified by:
prepareDocumentForEncryption
in classSecurityHandler<PublicKeyProtectionPolicy>
- Parameters:
dictionary
- encryption dictionarydocumentID
- document ID bytes- Throws:
java.io.IOException
- If there is an error while encrypting.
-
-