|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.core.pobjects.Dictionary
org.icepdf.core.pobjects.security.EncryptionDictionary
public class EncryptionDictionary
The EncryptionDictionary class is used to hold values needed by the Standard Security Handler, Public Key Handlers and Crypt filters. This PDF object is found via a document's Trailer object, but only when the Trailer has an encrypted named reference.
The dictionary is composed of combinations of the following entries defined by the different encryption types. ICEpdf currently only supports the Standard Security Handler.
| Common to all Encryption Dictionaries | ||
| Key | Type | Value |
| Filter | name | (Required) The name of the preferred security handler for this document; typically it is the name of the security handler that was used to encrypt the document. If SubFilter is not present, only this security handler should be used when opening the document. If it is present, viewer applications are free to use any security handler that implements the format specified by SubFilter. |
| SubFilter | name | (Optional; PDF 1.3) A name that completely specifies the format and interpretation of the contents of the encryption dictionary. It is needed in order to allow security handlers other than the one specified by Filter to decrypt the document. If it is absent, other security handlers will not be able to decrypt the document. |
| V | number | (Optional but strongly recommended) A code specifying the algorithm
to be used in encrypting and decrypting the document:
|
| Length | integer | (Optional; PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits. The value must be a multiple of 8, in the range 40 to 128. Default value: 40. |
| CF | dictionary | (Optional; meaningful only when the value of V is 4; PDF 1.5) A dictionary whose keys are crypt filter names and whose values are the corresponding crypt filter dictionaries. |
| StmF | name | (Optional; meaningful only when the value of V is 4; PDF 1.5) The name of the crypt filter that is used by default when encrypting streams; it must correspond to a key in the CF dictionary or a standard crypt filter name. All streams in the document, except for cross-reference streams or those that have a crypt entry in their Filter array are decrypted by the security handler, using this crypt filter. |
| StrF | name | (Optional; meaningful only when the value of V is 4; PDF 1.5) The name of the crypt filter that is used when decrypting all strings in the document; it must correspond to a key in the CF dictionary or a standard crypt filter name. |
The dictionary composes of the following values that can be returned via their named mehtod or by a generic getValue method if the key's name is known. The values of the O and U entries in this dictionary are used to determine whether a password entered when the document is opened is the correct owner password, user password, or neither.
| Standard Encryption Dictionary Entries | ||
| Key | Type | Value |
| R | number |
(Required) A number specifying which revision of the standard security handler should be used to interpret this dictionary. The revision number should be:
|
| O | String | (Required) A 32-byte string, based on both the owner and user passwords, that is used in computing the encryption key and in determining whether a valid owner password was entered. |
| U | String | U string (Required) A 32-byte string, based on the user password, that is used in determining whether to prompt the user for a password and, if so, whether a valid user or owner password was entered. |
| P | Integer | (Required) A set of flags specifying which operations are permitted when the document is opened with user access. |
Encryption dictionaries for public-key security handlers contain the common entries shown above. In addition, they may contain the entries shown below.
| Additional public-key Dictionary Entries | ||
| Key | Type | Value |
| Recipients | array | (Required when SubFilter is adbe.pkcs7.s3 or adbe.pkcs7.s4; PDF 1.3)
An array of strings, where each string is a PKCS#7 object listing
recipients that have been granted equal access rights to the document.
The data contained in the PKCS#7 object includes both a cryptographic
key that is used to decrypt the encrypted data and the access
permissions that apply to the recipient list. There should be only
one object per unique set of access permissions; if a recipient
appears in more than one list, the permissions used will be those
found in the first matching list. Note: When SubFilter is adbe.pkcs7.s5, recipient lists are specified in the crypt filter dictionary. |
Encryption dictionaries for crypt filter security handlers contain the common entries shown above. In addition, they may contain the entries shown below
| Standard Encryption Dictionary Entries | ||
| Key | Type | Value |
| Type | name | (Optional) If present, must be CryptFilter for a crypt filter dictionary. |
| CFM | name | (Optional) The method used, if any, by the viewer application to
decrypt data. In PDF 1.5, the following values are supported:
|
| Length | integer | (Optional) When the value of CFM is V2, this entry is used to indicate the bit length of the decryption key. It must be a multiple of 8 in the range of 40 to 128. Default value: 128. When the value of CFM is None, security handlers can define their own use of this entry, but are encouraged to follow the usage conventions defined for V2. |
| AuthEvent | name |
(Optional) The event to be used to trigger the authorization that is
required to access decryption keys used by this filter. If
authorization fails, the event should fail. Acceptable values are:
|
| Field Summary | |
|---|---|
static Name |
CF_KEY
|
static Name |
EEF_KEY
|
static Name |
ENCRYPT_METADATA_KEY
|
static Name |
FILTER_KEY
|
static Name |
LENGTH_KEY
|
static Name |
O_KEY
|
static Name |
OE_KEY
|
static Name |
P_KEY
|
static Name |
PERMS_KEY
|
static Name |
R_KEY
|
static Name |
STMF_KEY
|
static Name |
STRF_KEY
|
static Name |
SUB_FILTER_KEY
|
static Name |
U_KEY
|
static Name |
UE_KEY
|
static Name |
V_KEY
|
| Fields inherited from class org.icepdf.core.pobjects.Dictionary |
|---|
entries, FORM_TYPE_KEY, inited, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY |
| Constructor Summary | |
|---|---|
EncryptionDictionary(Library lib,
java.util.HashMap encryptionDictionary,
java.util.List fileID)
Creates a new Encryption Dictionary object. |
|
| Method Summary | |
|---|---|
java.lang.String |
getBigO()
Gets the 32-byte string used for verifying the owner password. |
java.lang.String |
getBigOE()
Gets the 32-byte string, based on the owner and user passwords, that is used in the computing the encryption key. |
java.lang.String |
getBigU()
Gets the 32-byte string used for verifying the user password. |
java.lang.String |
getBigUE()
Gets the 32-byte string, based on the user password, that is used in the computing the encryption key. |
CryptFilter |
getCryptFilter()
(Optional; meaningful only when the value of V is 4; PDF 1.5) A dictionary whose keys shall be crypt filter names and whose values shall be the corresponding crypt filter dictionaries (see Table 25). |
Name |
getEEF()
(Optional; meaningful only when the value of V is 4; PDF 1.6) The name of the crypt filter that shall be used when encrypting embedded file streams that do not have their own crypt filter specifier; it shall correspond to a key in the CFdictionary or a standard crypt filter name specified in Table 26. |
java.util.HashMap |
getEntries()
Gets all the dictionary properties. |
java.util.List |
getFileID()
Gets the document's File ID. |
int |
getKeyLength()
Gets the length of the encryption key, in bits. |
int |
getPermissions()
Gets the integer flag which specifies the operation permitted when the document is opened with user access. |
java.lang.String |
getPerms()
A16-byte string, encrypted with the file encryption key, that contains an encrypted copy of the permission flags. |
Name |
getPreferredSecurityHandlerName()
Gets the preferred security handler name. |
Name |
getPreferredSecurityHandlerSubName()
Gets the preferred security handler sub-name. |
int |
getRevisionNumber()
Gets the revision number of the standard security handler. |
Name |
getStmF()
(Optional; meaningful only when the value of V is 4; PDF 1.5) The name of the crypt filter that shall be used by default when decrypting streams. |
Name |
getStrF()
(Optional; meaningful only when the value of V is 4; PDF 1.5) The name of the crypt filter that shall be used when decrypting all strings in the document. |
java.lang.Object |
getValue(java.lang.Object key)
Gets any dictionary key specified by the key parameter. |
int |
getVersion()
Gets a code specifying the algorithm to be used in encrypting and decrypting the document: 0 An algorithm that is undocumented. |
protected boolean |
isAuthenticatedOwnerPassword()
|
protected boolean |
isAuthenticatedUserPassword()
|
boolean |
isEncryptMetaData()
Indicates whether the document-level metadata stream (see Section 10.2.2, "Metadata Streams") is to be encrypted. |
protected void |
setAuthenticatedOwnerPassword(boolean authenticatedOwnerPassword)
|
protected void |
setAuthenticatedUserPassword(boolean authenticatedUserPassword)
|
java.lang.String |
toString()
Returns a summary of the dictionary entries. |
| Methods inherited from class org.icepdf.core.pobjects.Dictionary |
|---|
getFloat, getInt, getLibrary, getNumber, getObject, getPObjectReference, init, isDeleted, isNew, setDeleted, setNew, setPObjectReference |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Name FILTER_KEY
public static final Name SUB_FILTER_KEY
public static final Name V_KEY
public static final Name LENGTH_KEY
public static final Name R_KEY
public static final Name O_KEY
public static final Name U_KEY
public static final Name P_KEY
public static final Name CF_KEY
public static final Name STMF_KEY
public static final Name STRF_KEY
public static final Name EEF_KEY
public static final Name OE_KEY
public static final Name UE_KEY
public static final Name PERMS_KEY
public static final Name ENCRYPT_METADATA_KEY
| Constructor Detail |
|---|
public EncryptionDictionary(Library lib,
java.util.HashMap encryptionDictionary,
java.util.List fileID)
lib - library dictionary of all objects in document.encryptionDictionary - dictionary of all values taken from encrypt key
in the documents Trailer reference.fileID - Vector containing the two file ID values originally
parsed from the Trailer reference.| Method Detail |
|---|
public java.util.List getFileID()
public Name getPreferredSecurityHandlerName()
public Name getPreferredSecurityHandlerSubName()
public int getVersion()
public int getKeyLength()
public int getRevisionNumber()
public java.lang.String getBigO()
public java.lang.String getBigU()
public int getPermissions()
public CryptFilter getCryptFilter()
public Name getStmF()
public Name getStrF()
public Name getEEF()
public java.lang.String getBigOE()
public java.lang.String getBigUE()
public java.lang.String getPerms()
public boolean isEncryptMetaData()
protected boolean isAuthenticatedUserPassword()
protected void setAuthenticatedUserPassword(boolean authenticatedUserPassword)
protected boolean isAuthenticatedOwnerPassword()
protected void setAuthenticatedOwnerPassword(boolean authenticatedOwnerPassword)
public java.lang.Object getValue(java.lang.Object key)
key - named key to retrieve from dictionary.
public java.util.HashMap getEntries()
getEntries in class Dictionarypublic java.lang.String toString()
Dictionary
toString in class Dictionary
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||