multivalent.std.adaptor.pdf

Class SecurityHandlerStandard

public class SecurityHandlerStandard extends SecurityHandler

Implements "standard encryption" defined in Adobe's PDF Reference.

Bit masks for permission bits are given with PERM_ prefix.

Version: $Revision: 1.24 $ $Date: 2003/08/17 08:40:44 $

Field Summary
static intPERM_ALL
static intPERM_ANNO
Permission: Add or modify text annotations, fill in interactive form fields, and, if PERM_MODIFY is also set, create or modify interactive form fields (including signature fields).
static intPERM_ASSEMBLE
Permission: (Revision 3 only) Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if PERM_MODIFY is clear.
static intPERM_COPY
Permission: (Revision 2) Copy or otherwise extract text and graphics from the document, including extracting text and graphics (in support of accessibility to disabled users or for other purposes).
static intPERM_COPY_R3
Permission: (Revision 3 only) Extract text and graphics (in support of accessibility to disabled users or for other purposes).
static intPERM_FILL
Permission: (Revision 3 only) Fill in existing interactive form fields (including signature fields), even if PERM_ANNO is clear.
static intPERM_MODIFY
Permission: Modify the contents of the document by operations other than those controlled by PERM_ANNO, PERM_FILL, PERM_ASSEMBLE.
static intPERM_NONE
static intPERM_PRINT
Permission: (Revision 2) Print the document.
static intPERM_PRINT_GOOD
Permission: Permission: (Revision 3 only) Print the document to a representation from which a faithful digital copy of the PDF content could be generated.
Constructor Summary
SecurityHandlerStandard(Dict edict, COSSource coss)
SecurityHandlerStandard(StringBuffer id0, int R, int P, int Length, String userpassword, String ownerpassword)
Construct a Standard encryption filter with given parameters and passwords.
SecurityHandlerStandard(byte[] key)
Method Summary
booleanauthOwner(String owner)
Algorithm 3.7 Authenticating the owner password.
booleanauthUser(String user)
Algorithm 3.6 Authenticating the user password.
Objectclone()
byte[]computeKey(String password)
byte[]computeKey(String password, int keylen)
Algorithm 3.2 Computing an encryption key.
StringBuffercomputeO(String owner, String user)
Algorithm 3.3 Computing the encryption dictionary'ís O (owner password) value.
StringBuffercomputeU(String user)
Algorithm 3.4 Computing the encryption dictionary's U (user password) value (Revision 2), and Algorithm 3.5 Computing the encryption dictionary's U (user password) value (Revision 3)
byte[]decrypt(byte[] data, int off, int len)
byte[]encrypt(byte[] data, int off, int len)
static byte[]encrypt(byte[] key, byte[] data, int off, int len, int objnum, int gennum)
Algorithm 3.1 Encryption of data using an encryption key.
byte[]getKey()
intgetLength()
Returns length of encryption key.
intgetP()
Returns permission bits.
intgetR()
Returns version of standard security handler.
booleanisAuthorized()
protected static byte[]pad(String str)
Algorithm 3.2, Step 1.
SecurityHandlerreset(int objnum, int gennum)

Field Detail

PERM_ALL

public static final int PERM_ALL

PERM_ANNO

public static final int PERM_ANNO
Permission: Add or modify text annotations, fill in interactive form fields, and, if PERM_MODIFY is also set, create or modify interactive form fields (including signature fields).

PERM_ASSEMBLE

public static final int PERM_ASSEMBLE
Permission: (Revision 3 only) Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if PERM_MODIFY is clear.

PERM_COPY

public static final int PERM_COPY
Permission: (Revision 2) Copy or otherwise extract text and graphics from the document, including extracting text and graphics (in support of accessibility to disabled users or for other purposes). (Revision 3) Copy or otherwise extract text and graphics from the document by operations other than that controlled by PERM_COPY_R3.

PERM_COPY_R3

public static final int PERM_COPY_R3
Permission: (Revision 3 only) Extract text and graphics (in support of accessibility to disabled users or for other purposes).

PERM_FILL

public static final int PERM_FILL
Permission: (Revision 3 only) Fill in existing interactive form fields (including signature fields), even if PERM_ANNO is clear.

PERM_MODIFY

public static final int PERM_MODIFY
Permission: Modify the contents of the document by operations other than those controlled by PERM_ANNO, PERM_FILL, PERM_ASSEMBLE.

PERM_NONE

public static final int PERM_NONE

PERM_PRINT

public static final int PERM_PRINT
Permission: (Revision 2) Print the document. (Revision 3) Print the document (possibly not at the highest quality level, depending on whether PERM_PRINT_GOOD is also set.

PERM_PRINT_GOOD

public static final int PERM_PRINT_GOOD
Permission: Permission: (Revision 3 only) Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this bit is clear (and PERM_PRINT is set), printing is limited to a lowlevel representation of the appearance, possibly of degraded quality.

Constructor Detail

SecurityHandlerStandard

public SecurityHandlerStandard(Dict edict, COSSource coss)

SecurityHandlerStandard

public SecurityHandlerStandard(StringBuffer id0, int R, int P, int Length, String userpassword, String ownerpassword)
Construct a Standard encryption filter with given parameters and passwords. Sets key for further encryption/decryption.

SecurityHandlerStandard

public SecurityHandlerStandard(byte[] key)

Method Detail

authOwner

public boolean authOwner(String owner)
Algorithm 3.7 Authenticating the owner password.

authUser

public boolean authUser(String user)
Algorithm 3.6 Authenticating the user password.

clone

public Object clone()

computeKey

public byte[] computeKey(String password)

computeKey

public byte[] computeKey(String password, int keylen)
Algorithm 3.2 Computing an encryption key.

computeO

public StringBuffer computeO(String owner, String user)
Algorithm 3.3 Computing the encryption dictionary'ís O (owner password) value.

computeU

public StringBuffer computeU(String user)
Algorithm 3.4 Computing the encryption dictionary's U (user password) value (Revision 2), and Algorithm 3.5 Computing the encryption dictionary's U (user password) value (Revision 3)

decrypt

public byte[] decrypt(byte[] data, int off, int len)

encrypt

public byte[] encrypt(byte[] data, int off, int len)

encrypt

public static byte[] encrypt(byte[] key, byte[] data, int off, int len, int objnum, int gennum)
Algorithm 3.1 Encryption of data using an encryption key.

getKey

public byte[] getKey()

getLength

public int getLength()
Returns length of encryption key.

getP

public int getP()
Returns permission bits. If a bit position is 1 according to PERM_ bitmask, the user has that permission.

See Also: ContractualObligation

getR

public int getR()
Returns version of standard security handler.

isAuthorized

public boolean isAuthorized()

pad

protected static byte[] pad(String str)
Algorithm 3.2, Step 1.

reset

public SecurityHandler reset(int objnum, int gennum)