org.pdfbox.pdmodel.encryption

Class 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

decryptDocument, decryptStream, decryptString, encryptData, getCurrentAccessPermission, getKeyLength, prepareDocumentForEncryption, proceedDecryption, setKeyLength

Field Details

FILTER

public static final String FILTER
The filter name.

Constructor Details

PublicKeySecurityHandler

public PublicKeySecurityHandler()
Constructor.

PublicKeySecurityHandler

public PublicKeySecurityHandler(PublicKeyProtectionPolicy p)
Constructor used for encryption.
Parameters:
p - The protection policy.

Method Details

decryptDocument

public void decryptDocument(PDDocument doc,
                            DecryptionMaterial decryptionMaterial)
            throws CryptographyException,
                   IOException
Decrypt the document.
Overrides:
decryptDocument in interface SecurityHandler
Parameters:
doc - The document to decrypt.
decryptionMaterial - The data used to decrypt the document.
Throws:
CryptographyException - If there is an error during decryption.

prepareDocumentForEncryption

public void prepareDocumentForEncryption(PDDocument doc)
            throws CryptographyException
Prepare the document for encryption.
Overrides:
prepareDocumentForEncryption in interface SecurityHandler
Parameters:
doc - The document that will be encrypted.
Throws:
CryptographyException - If there is an error while encrypting.