org.pdfbox.pdmodel.encryption
Class PublicKeySecurityHandler

java.lang.Object
  extended byorg.pdfbox.pdmodel.encryption.SecurityHandler
      extended byorg.pdfbox.pdmodel.encryption.PublicKeySecurityHandler

public class PublicKeySecurityHandler
extends SecurityHandler

This class implements the public key security handler described in the PDF specification.

Version:
$Revision: 1.3 $
Author:
Benoit Guillon (benoit.guillon@snv.jussieu.fr)
See Also:
Spec 1.6 p104, to see how to protect document with this security handler.

Field Summary
static String FILTER
          The filter name.
 
Fields inherited from class org.pdfbox.pdmodel.encryption.SecurityHandler
currentAccessPermission, document, encryptionKey, keyLength, rc4, version
 
Constructor Summary
PublicKeySecurityHandler()
          Constructor.
PublicKeySecurityHandler(PublicKeyProtectionPolicy p)
          Constructor used for encryption.
 
Method Summary
 void decryptDocument(PDDocument doc, DecryptionMaterial decryptionMaterial)
          Decrypt the document.
 void prepareDocumentForEncryption(PDDocument doc)
          Prepare the document for encryption.
 
Methods inherited from class org.pdfbox.pdmodel.encryption.SecurityHandler
decryptStream, decryptString, encryptData, getCurrentAccessPermission, getKeyLength, proceedDecryption, setKeyLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER

public static final String FILTER
The filter name.

See Also:
Constant Field Values
Constructor Detail

PublicKeySecurityHandler

public PublicKeySecurityHandler()
Constructor.


PublicKeySecurityHandler

public PublicKeySecurityHandler(PublicKeyProtectionPolicy p)
Constructor used for encryption.

Parameters:
p - The protection policy.
Method Detail

decryptDocument

public void decryptDocument(PDDocument doc,
                            DecryptionMaterial decryptionMaterial)
                     throws CryptographyException,
                            IOException
Decrypt the document.

Specified by:
decryptDocument in class SecurityHandler
Parameters:
doc - The document to decrypt.
decryptionMaterial - The data used to decrypt the document.
Throws:
CryptographyException - If there is an error during decryption.
IOException - If there is an error accessing data.

prepareDocumentForEncryption

public void prepareDocumentForEncryption(PDDocument doc)
                                  throws CryptographyException
Prepare the document for encryption.

Specified by:
prepareDocumentForEncryption in class SecurityHandler
Parameters:
doc - The document that will be encrypted.
Throws:
CryptographyException - If there is an error while encrypting.