Package org.apache.fop.pdf
Class PDFEncryptionJCE
java.lang.Object
org.apache.fop.pdf.PDFObject
org.apache.fop.pdf.PDFEncryptionJCE
- All Implemented Interfaces:
PDFEncryption
,PDFWritable
An implementation of the Standard Security Handler.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyFilter
(AbstractPDFStream stream) Adds a PDFFilter to the PDFStream objectbyte[]
Encrypt an array of bytes using a reference PDFObject for calculating the encryption key.Returns the PDF version required by the current encryption algorithm.Returns the /Encrypt entry in the file trailer dictionary.static PDFEncryption
make
(PDFObjectNumber objectNumber, PDFEncryptionParams params, PDFDocument pdf) Creates and returns an encryption object.byte[]
toPDF()
Prepares the encryption dictionary for output to a PDF file.Methods inherited from class org.apache.fop.pdf.PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getChildren, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDFString
-
Method Details
-
make
public static PDFEncryption make(PDFObjectNumber objectNumber, PDFEncryptionParams params, PDFDocument pdf) Creates and returns an encryption object.- Parameters:
objectNumber
- the object number for the encryption dictionaryparams
- the encryption parameterspdf
- the PDF document to be encrypted- Returns:
- the newly created encryption object
-
encrypt
Encrypt an array of bytes using a reference PDFObject for calculating the encryption key.- Specified by:
encrypt
in interfacePDFEncryption
- Parameters:
data
- data to encryptrefObj
- reference PDFObject- Returns:
- byte[] the encrypted data
-
applyFilter
Adds a PDFFilter to the PDFStream object- Specified by:
applyFilter
in interfacePDFEncryption
- Parameters:
stream
- the stream to add an encryption filter to
-
toPDF
public byte[] toPDF()Prepares the encryption dictionary for output to a PDF file. -
getTrailerEntry
Returns the /Encrypt entry in the file trailer dictionary.- Specified by:
getTrailerEntry
in interfacePDFEncryption
- Returns:
- the string "/Encrypt n g R\n" where n and g are the number and generation of the document's encryption dictionary
-
getPDFVersion
Returns the PDF version required by the current encryption algorithm.- Specified by:
getPDFVersion
in interfacePDFEncryption
- Returns:
- the PDF Version
-