com.sun.pdfview.decrypt
Class PDFDecrypterFactory

java.lang.Object
  extended by com.sun.pdfview.decrypt.PDFDecrypterFactory

public class PDFDecrypterFactory
extends java.lang.Object

Produces a PDFDecrypter for documents given a (possibly non-existent) Encrypt dictionary. Supports decryption of versions 1, 2 and 4 of the password-based encryption mechanisms as described in PDF Reference version 1.7. This means that it supports RC4 and AES encryption with keys of 40-128 bits; esentially, password-protected documents with compatibility up to Acrobat 8.


Field Summary
static java.lang.String CF_IDENTITY
          The name of the standard Identity CryptFilter
 
Constructor Summary
PDFDecrypterFactory()
           
 
Method Summary
static PDFDecrypter createDecryptor(PDFObject encryptDict, PDFObject documentId, PDFPassword password)
          Create a decryptor for a given encryption dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CF_IDENTITY

public static final java.lang.String CF_IDENTITY
The name of the standard Identity CryptFilter

See Also:
Constant Field Values
Constructor Detail

PDFDecrypterFactory

public PDFDecrypterFactory()
Method Detail

createDecryptor

public static PDFDecrypter createDecryptor(PDFObject encryptDict,
                                           PDFObject documentId,
                                           PDFPassword password)
                                    throws java.io.IOException,
                                           EncryptionUnsupportedByPlatformException,
                                           EncryptionUnsupportedByProductException,
                                           PDFAuthenticationFailureException
Create a decryptor for a given encryption dictionary. A check is immediately performed that the supplied password decrypts content described by the encryption specification.

Parameters:
encryptDict - the Encrypt dict as found in the document's trailer. May be null, in which case the IdentityDecrypter will be returned.
documentId - the object with key "ID" in the trailer's dictionary. Should always be present if Encrypt is.
password - the password to use; may be null
Returns:
The decryptor that should be used for all encrypted data in the PDF
Throws:
java.io.IOException - will typically be a PDFParseException, indicating an IO problem, an error in the structure of the document, or a failure to obtain various ciphers from the installed JCE providers
EncryptionUnsupportedByPlatformException - if the encryption is not supported by the environment in which the code is executing
EncryptionUnsupportedByProductException - if PDFRenderer does not currently support the specified encryption
PDFAuthenticationFailureException - if the supplied password was not able to