PDEncryptionDictionary
public class PDEncryption
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_LENGTH |
The default length for the encryption key.
|
static java.lang.String |
DEFAULT_NAME |
The default security handler.
|
static int |
DEFAULT_VERSION |
The default version, according to the PDF Reference.
|
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 | Description |
---|---|
PDEncryption() |
creates a new empty encryption dictionary.
|
PDEncryption(COSDictionary dictionary) |
creates a new encryption dictionary from the low level dictionary provided.
|
Modifier and Type | Method | Description |
---|---|---|
COSDictionary |
getCOSDictionary() |
This will get the dictionary associated with this encryption dictionary.
|
PDCryptFilterDictionary |
getCryptFilterDictionary(COSName cryptFilterName) |
Returns the crypt filter with the given name.
|
java.lang.String |
getFilter() |
Get the name of the filter.
|
int |
getLength() |
This will return the Length entry of the encryption dictionary.
The length in bits for the encryption algorithm. |
byte[] |
getOwnerEncryptionKey() |
This will get the OE entry in the standard encryption dictionary.
|
byte[] |
getOwnerKey() |
This will get the O entry in the standard encryption dictionary.
|
int |
getPermissions() |
This will get the permissions bit mask.
|
byte[] |
getPerms() |
Get the Perms entry in the encryption dictionary.
|
int |
getRecipientsLength() |
Returns the number of recipients contained in the Recipients field of the dictionary.
|
COSString |
getRecipientStringAt(int i) |
returns the COSString contained in the Recipients field at position i.
|
int |
getRevision() |
This will return the R entry of the encryption dictionary.
See PDF Reference 1.4 Table 3.14. |
SecurityHandler |
getSecurityHandler() |
Returns the security handler specified in the dictionary's Filter entry.
|
PDCryptFilterDictionary |
getStdCryptFilterDictionary() |
Returns the standard crypt filter.
|
COSName |
getStreamFilterName() |
Returns the name of the filter which is used for de/encrypting streams.
|
COSName |
getStringFilterName() |
Returns the name of the filter which is used for de/encrypting strings.
|
java.lang.String |
getSubFilter() |
Get the name of the subfilter.
|
byte[] |
getUserEncryptionKey() |
This will get the UE entry in the standard encryption dictionary.
|
byte[] |
getUserKey() |
This will get the U entry in the standard encryption dictionary.
|
int |
getVersion() |
This will return the V entry of the encryption dictionary.
See PDF Reference 1.4 Table 3.13. |
boolean |
hasSecurityHandler() |
Returns true if the security handler specified in the dictionary's Filter is available.
|
boolean |
isEncryptMetaData() |
Will get the EncryptMetaData dictionary info.
|
void |
removeV45filters() |
remove CF, StmF, and StrF entries.
|
void |
setCryptFilterDictionary(COSName cryptFilterName,
PDCryptFilterDictionary cryptFilterDictionary) |
Sets the crypt filter with the given name.
|
void |
setFilter(java.lang.String filter) |
Sets the filter entry of the encryption dictionary.
|
void |
setLength(int length) |
This will set the number of bits to use for the encryption algorithm.
|
void |
setOwnerEncryptionKey(byte[] oe) |
This will set the OE entry in the standard encryption dictionary.
|
void |
setOwnerKey(byte[] o) |
This will set the O entry in the standard encryption dictionary.
|
void |
setPermissions(int permissions) |
This will set the permissions bit mask.
|
void |
setPerms(byte[] perms) |
Set the Perms entry in the encryption dictionary.
|
void |
setRecipients(byte[][] recipients) |
This will set the Recipients field of the dictionary.
|
void |
setRevision(int revision) |
This will set the R entry of the encryption dictionary.
See PDF Reference 1.4 Table 3.14. |
void |
setSecurityHandler(SecurityHandler securityHandler) |
Sets the security handler used in this encryption dictionary
|
void |
setStdCryptFilterDictionary(PDCryptFilterDictionary cryptFilterDictionary) |
Sets the standard crypt filter.
|
void |
setStreamFilterName(COSName streamFilterName) |
Sets the name of the filter which is used for de/encrypting streams.
|
void |
setStringFilterName(COSName stringFilterName) |
Sets the name of the filter which is used for de/encrypting strings.
|
void |
setSubFilter(java.lang.String subfilter) |
Set the subfilter entry of the encryption dictionary.
|
void |
setUserEncryptionKey(byte[] ue) |
This will set the UE entry in the standard encryption dictionary.
|
void |
setUserKey(byte[] u) |
This will set the U entry in the standard encryption dictionary.
|
void |
setVersion(int version) |
This will set the V entry of the encryption dictionary.
See PDF Reference 1.4 Table 3.13. |
public static final int VERSION0_UNDOCUMENTED_UNSUPPORTED
public static final int VERSION1_40_BIT_ALGORITHM
public static final int VERSION2_VARIABLE_LENGTH_ALGORITHM
public static final int VERSION3_UNPUBLISHED_ALGORITHM
public static final int VERSION4_SECURITY_HANDLER
public static final java.lang.String DEFAULT_NAME
public static final int DEFAULT_LENGTH
public static final int DEFAULT_VERSION
public PDEncryption()
public PDEncryption(COSDictionary dictionary)
dictionary
- a COS encryption dictionarypublic SecurityHandler getSecurityHandler() throws java.io.IOException
java.io.IOException
- if there is no security handler available which matches the Filterpublic void setSecurityHandler(SecurityHandler securityHandler)
securityHandler
- new security handlerpublic boolean hasSecurityHandler()
public COSDictionary getCOSDictionary()
public void setFilter(java.lang.String filter)
filter
- The filter name.public final java.lang.String getFilter()
public java.lang.String getSubFilter()
public void setSubFilter(java.lang.String subfilter)
subfilter
- The value of the subfilter field.public void setVersion(int version)
version
- The new encryption version.public int getVersion()
public void setLength(int length)
length
- The new key length.public int getLength()
public void setRevision(int revision)
revision
- The new encryption version.public int getRevision()
public void setOwnerKey(byte[] o) throws java.io.IOException
o
- A 32 byte array or null if there is no owner key.java.io.IOException
- If there is an error setting the data.public byte[] getOwnerKey() throws java.io.IOException
java.io.IOException
- If there is an error accessing the data.public void setUserKey(byte[] u) throws java.io.IOException
u
- A 32 byte array.java.io.IOException
- If there is an error setting the data.public byte[] getUserKey() throws java.io.IOException
java.io.IOException
- If there is an error accessing the data.public void setOwnerEncryptionKey(byte[] oe) throws java.io.IOException
oe
- A 32 byte array or null if there is no owner encryption key.java.io.IOException
- If there is an error setting the data.public byte[] getOwnerEncryptionKey() throws java.io.IOException
java.io.IOException
- If there is an error accessing the data.public void setUserEncryptionKey(byte[] ue) throws java.io.IOException
ue
- A 32 byte array or null if there is no user encryption key.java.io.IOException
- If there is an error setting the data.public byte[] getUserEncryptionKey() throws java.io.IOException
java.io.IOException
- If there is an error accessing the data.public void setPermissions(int permissions)
permissions
- The new permissions bit maskpublic int getPermissions()
public boolean isEncryptMetaData()
public void setRecipients(byte[][] recipients) throws java.io.IOException
recipients
- the array of bytes arrays to put in the Recipients field.java.io.IOException
- If there is an error setting the data.public int getRecipientsLength()
public COSString getRecipientStringAt(int i)
i
- the position in the Recipients field array.public PDCryptFilterDictionary getStdCryptFilterDictionary()
public PDCryptFilterDictionary getCryptFilterDictionary(COSName cryptFilterName)
cryptFilterName
- the name of the crypt filterpublic void setCryptFilterDictionary(COSName cryptFilterName, PDCryptFilterDictionary cryptFilterDictionary)
cryptFilterName
- the name of the crypt filtercryptFilterDictionary
- the crypt filter to setpublic void setStdCryptFilterDictionary(PDCryptFilterDictionary cryptFilterDictionary)
cryptFilterDictionary
- the standard crypt filter to setpublic COSName getStreamFilterName()
public void setStreamFilterName(COSName streamFilterName)
streamFilterName
- the name of the filterpublic COSName getStringFilterName()
public void setStringFilterName(COSName stringFilterName)
stringFilterName
- the name of the filterpublic void setPerms(byte[] perms) throws java.io.IOException
perms
- A 16 byte array.java.io.IOException
- If there is an error setting the data.public byte[] getPerms() throws java.io.IOException
java.io.IOException
- If there is an error accessing the data.public void removeV45filters()
Copyright © 2002–2018. All rights reserved.