org.apache.fop.pdf

Class PDFEncryptionJCE

Implemented Interfaces:
PDFEncryption, PDFWritable

public class PDFEncryptionJCE
extends PDFObject
implements PDFEncryption

class representing a /Filter /Standard object.

Field Summary

static int
PERMISSION_COPY_CONTENT
Value of content extraction permission
static int
PERMISSION_EDIT_ANNOTATIONS
Value of annotation editting permission
static int
PERMISSION_EDIT_CONTENT
Value of content editting permission
static int
PERMISSION_PRINT
Value of PRINT permission

Fields inherited from class org.apache.fop.pdf.PDFObject

DATE_FORMAT, log

Constructor Summary

PDFEncryptionJCE(int objnum)
Create a /Filter /Standard object.

Method Summary

void
applyFilter(AbstractPDFStream stream)
Adds a PDFFilter to the PDFStream object
byte[]
encrypt(byte[] data, PDFObject refObj)
byte[]
encryptData(byte[] data, int number, int generation)
This method encrypts the passed data using the generated keys.
byte[]
getFileID()
Returns the document file ID
String
getFileID(int index)
This method returns the indexed file ID
PDFEncryptionParams
getParams()
Returns the encryption parameters.
String
getTrailerEntry()
void
init()
This method initializes the encryption algorithms and values
static PDFEncryption
make(int objnum, PDFEncryptionParams params)
Local factory method.
PDFFilter
makeFilter(int number, int generation)
Creates PDFFilter for the encryption object
void
setParams(PDFEncryptionParams params)
Sets the encryption parameters.
byte[]
toPDF()
Represent the object in PDF

Methods inherited from class org.apache.fop.pdf.PDFObject

encode, encodeString, encodeText, formatDateTime, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, hasObjectNumber, makeReference, output, referencePDF, setDocument, setObjectNumber, toInlinePDFString, toPDF, toPDFString

Field Details

PERMISSION_COPY_CONTENT

public static final int PERMISSION_COPY_CONTENT
Value of content extraction permission
Field Value:
16

PERMISSION_EDIT_ANNOTATIONS

public static final int PERMISSION_EDIT_ANNOTATIONS
Value of annotation editting permission
Field Value:
32

PERMISSION_EDIT_CONTENT

public static final int PERMISSION_EDIT_CONTENT
Value of content editting permission
Field Value:
8

PERMISSION_PRINT

public static final int PERMISSION_PRINT
Value of PRINT permission
Field Value:
4

Constructor Details

PDFEncryptionJCE

public PDFEncryptionJCE(int objnum)
Create a /Filter /Standard object.
Parameters:
objnum - the object's number

Method Details

applyFilter

public void applyFilter(AbstractPDFStream stream)
Adds a PDFFilter to the PDFStream object
Specified by:
applyFilter in interface PDFEncryption
Parameters:
stream - the stream to add an encryption filter to

encrypt

public byte[] encrypt(byte[] data,
                      PDFObject refObj)
Specified by:
encrypt in interface PDFEncryption

encryptData

public byte[] encryptData(byte[] data,
                          int number,
                          int generation)
This method encrypts the passed data using the generated keys.
Parameters:
data - The data to be encrypted
number - The block number
generation - The block generation
Returns:
The encrypted data

getFileID

public byte[] getFileID()
Returns the document file ID
Returns:
The file ID

getFileID

public String getFileID(int index)
This method returns the indexed file ID
Parameters:
index - The index to access the file ID
Returns:
The file ID

getParams

public PDFEncryptionParams getParams()
Returns the encryption parameters.
Specified by:
getParams in interface PDFEncryption
Returns:
the encryption parameters

getTrailerEntry

public String getTrailerEntry()
Specified by:
getTrailerEntry in interface PDFEncryption

init

public void init()
This method initializes the encryption algorithms and values

make

public static PDFEncryption make(int objnum,
                                 PDFEncryptionParams params)
Local factory method.
Parameters:
objnum - PDF object number for the encryption object
params - PDF encryption parameters
Returns:
PDFEncryption the newly created PDFEncryption object

makeFilter

public PDFFilter makeFilter(int number,
                            int generation)
Creates PDFFilter for the encryption object
Parameters:
number - The object number
generation - The objects generation
Returns:
The resulting filter

setParams

public void setParams(PDFEncryptionParams params)
Sets the encryption parameters.
Specified by:
setParams in interface PDFEncryption
Parameters:
params - The parameterss to set

toPDF

public byte[] toPDF()
Represent the object in PDF
Overrides:
toPDF in interface PDFObject
Returns:
the PDF

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.