org.pdfbox.pdmodel.encryption
Class PDEncryptionDictionary

java.lang.Object
  extended by org.pdfbox.pdmodel.encryption.PDEncryptionDictionary
Direct Known Subclasses:
PDStandardEncryption

public abstract class PDEncryptionDictionary
extends Object

This represents the base class for encryption dictionaries. All PDF implementations are expected to implement the Standard encryption algorithm, but others can be plugged in. See PDF Reference 1.4 section "3.5 Encryption"

Version:
$Revision: 1.5 $
Author:
Ben Litchfield (ben@csh.rit.edu)

Field Summary
static int DEFAULT_LENGTH
          The default length for the encryption key.
static String DEFAULT_NAME
          The default security handler.
static int DEFAULT_VERSION
          The default version, according to the PDF Reference.
protected  COSDictionary encryptionDictionary
          The cos model wrapped object.
static int VERSION0_UNDOCUMENTED_UNSUPPORTED
          See PDF Reference 1.4 Table 3.13.
static int VERSION1_40_BIT_ALGORITHM
          See PDF Reference 1.4 Table 3.13.
static int VERSION2_VARIABLE_LENGTH_ALGORITHM
          See PDF Reference 1.4 Table 3.13.
static int VERSION3_UNPUBLISHED_ALGORITHM
          See PDF Reference 1.4 Table 3.13.
static int VERSION4_SECURITY_HANDLER
          See PDF Reference 1.4 Table 3.13.
 
Constructor Summary
protected PDEncryptionDictionary()
          Constructor, sub classes need to fill out the required fields.
protected PDEncryptionDictionary(COSDictionary dictionary)
          Constructor.
 
Method Summary
 COSDictionary getCOSDictionary()
          This will get the dictionary associated with this encryption dictionary.
 String getFilter()
          Read-only field of the encryption filter name.
 int getLength()
          This will return the Length entry of the encryption dictionary.
 int getVersion()
          This will return the V entry of the encryption dictionary.
 void setLength(int length)
          This will set the number of bits to use for the encryption algorithm.
 void setVersion(int version)
          This will set the V entry of the encryption dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION0_UNDOCUMENTED_UNSUPPORTED

public static final int VERSION0_UNDOCUMENTED_UNSUPPORTED
See PDF Reference 1.4 Table 3.13.

See Also:
Constant Field Values

VERSION1_40_BIT_ALGORITHM

public static final int VERSION1_40_BIT_ALGORITHM
See PDF Reference 1.4 Table 3.13.

See Also:
Constant Field Values

VERSION2_VARIABLE_LENGTH_ALGORITHM

public static final int VERSION2_VARIABLE_LENGTH_ALGORITHM
See PDF Reference 1.4 Table 3.13.

See Also:
Constant Field Values

VERSION3_UNPUBLISHED_ALGORITHM

public static final int VERSION3_UNPUBLISHED_ALGORITHM
See PDF Reference 1.4 Table 3.13.

See Also:
Constant Field Values

VERSION4_SECURITY_HANDLER

public static final int VERSION4_SECURITY_HANDLER
See PDF Reference 1.4 Table 3.13.

See Also:
Constant Field Values

DEFAULT_NAME

public static final String DEFAULT_NAME
The default security handler.

See Also:
Constant Field Values

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
The default length for the encryption key.

See Also:
Constant Field Values

DEFAULT_VERSION

public static final int DEFAULT_VERSION
The default version, according to the PDF Reference.

See Also:
Constant Field Values

encryptionDictionary

protected COSDictionary encryptionDictionary
The cos model wrapped object.

Constructor Detail

PDEncryptionDictionary

protected PDEncryptionDictionary(COSDictionary dictionary)
Constructor.

Parameters:
dictionary - The pre-existing encryption dictionary.

PDEncryptionDictionary

protected PDEncryptionDictionary()
Constructor, sub classes need to fill out the required fields.

Method Detail

getCOSDictionary

public COSDictionary getCOSDictionary()
This will get the dictionary associated with this encryption dictionary.

Returns:
The COS dictionary that this object wraps.

getFilter

public String getFilter()
Read-only field of the encryption filter name. The default value is "Standard" for the built in security handler.

Returns:
The name of the encryption handler.

getVersion

public int getVersion()
This will return the V entry of the encryption dictionary.

See PDF Reference 1.4 Table 3.13.

Returns:
The encryption version to use.

setVersion

public void setVersion(int version)
This will set the V entry of the encryption dictionary.

See PDF Reference 1.4 Table 3.13.

Note: This value is used to decrypt the pdf document. If you change this when the document is encrypted then decryption will fail!.

Parameters:
version - The new encryption version.

getLength

public int getLength()
This will return the Length entry of the encryption dictionary.

The length in bits for the encryption algorithm. This will return a multiple of 8.

Returns:
The length in bits for the encryption algorithm

setLength

public void setLength(int length)
This will set the number of bits to use for the encryption algorithm.

Parameters:
length - The new key length.


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.