Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## multivalent.std.adaptor.pdf
Class SecurityHandlerStandard

    java.lang.Object
      multivalent.std.adaptor.pdf.SecurityHandler
          multivalent.std.adaptor.pdf.SecurityHandlerStandard

All Implemented Interfaces:
  java.lang.Cloneable

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.27 $ $Date: 2005/02/20 10:40:56 $

Field Summary
`static int` | `PERM_ALL`
`static 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).
`static 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.
`static 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).
`static int` | `PERM_COPY_R3` Permission: (Revision 3 only) Extract text and graphics (in support of accessibility to disabled users or for other purposes).
`static int` | `PERM_DECRYPT` If the owner password was given, allow the document to be decrypted (extension to Adobe permission set).
`static int` | `PERM_FILL` Permission: (Revision 3 only) Fill in existing interactive form fields (including signature fields), even if `PERM_ANNO` is clear.
`static int` | `PERM_MODIFY` Permission: Modify the contents of the document by operations other than those controlled by `PERM_ANNO`, `PERM_FILL`, `PERM_ASSEMBLE`.
`static int` | `PERM_NONE`
`static int` | `PERM_PRINT` Permission: (Revision 2) Print the document.
`static int` | `PERM_PRINT_GOOD` Permission: (Revision 3 only) Print the document to a representation from which a faithful digital copy of the PDF content could be generated.

Fields inherited from class multivalent.std.adaptor.pdf.SecurityHandler
`IDENTITY`

Constructor Summary
`SecurityHandlerStandard(byte[] key)`
`SecurityHandlerStandard(Dict edict, COSSource coss)`
`SecurityHandlerStandard(java.lang.StringBuffer id0, int R, int P, int Length, java.lang.String userpassword, java.lang.String ownerpassword)` Construct a Standard encryption filter with given parameters and passwords.

Method Summary
`boolean` | `authOwner(java.lang.String owner)` Algorithm 3.7 Authenticating the owner password.
`boolean` | `authUser(java.lang.String user)` Algorithm 3.6 Authenticating the user password.
`java.lang.Object` | `clone()`
`byte[]` | `computeKey(java.lang.String password)`
`byte[]` | `computeKey(java.lang.String password, int keylen)` Algorithm 3.2 Computing an encryption key.
`java.lang.StringBuffer` | `computeO(java.lang.String owner, java.lang.String user)` Algorithm 3.3 Computing the encryption dictionary'’s O (owner password) value.
`java.lang.StringBuffer` | `computeU(java.lang.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)` Decrypts stream data of object objnum with generation gennum.
`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[]` | `encrypt(byte[] data, int off, int len)` Encrypts data of object objnum with generation gennum.
`byte[]` | `getKey()` CryptFilter may take key from a security handler and use in Adobe algorithms.
`int` | `getLength()` Returns length of encryption key.
`int` | `getP()` Returns value of P field from dictionary.
`int` | `getPerm()` Returns permission bits in effect.
`int` | `getR()` Returns version of standard security handler.
`boolean` | `isAuthorized()` Returns true if a valid decryption password, either user or owner, been set?
`protected static byte[]` | `pad(java.lang.String str)` Algorithm 3.2, Step 1.
`SecurityHandler` | `reset(int objnum, int gennum)` Resets for decrypting/encrypting another subobject of object at given number.

Methods inherited from class multivalent.std.adaptor.pdf.SecurityHandler
`getInstance, register`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PERM_ALL

    public static final int PERM_ALL

See Also:
  Constant Field Values

### PERM_NONE

    public static final int PERM_NONE

See Also:
  Constant Field Values

### 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.

  See Also:
    Constant Field Values

### 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`.

  See Also:
    Constant Field Values

### 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`.

  See Also:
    Constant Field Values

### 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).

  See Also:
    Constant Field Values

### 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.

  See Also:
    Constant Field Values

### 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).

  See Also:
    Constant Field Values

### 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.

  See Also:
    Constant Field Values

### PERM_PRINT_GOOD

    public static final int PERM_PRINT_GOOD

  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.

  See Also:
    Constant Field Values

### PERM_DECRYPT

    public static final int PERM_DECRYPT

  If the owner password was given, allow the document to be decrypted (extension to Adobe permission set).

  See Also:
    Constant Field Values

Constructor Detail

### SecurityHandlerStandard

    public SecurityHandlerStandard(Dict edict,
                                   COSSource coss)
                            throws ParseException

Throws:
  `ParseException`

### SecurityHandlerStandard

    public SecurityHandlerStandard(java.lang.StringBuffer id0,
                                   int R,
                                   int P,
                                   int Length,
                                   java.lang.String userpassword,
                                   java.lang.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

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `SecurityHandler`

### getLength

    public int getLength()

  Returns length of encryption key.

### getR

    public int getR()

  Returns version of standard security handler.

### getP

    public int getP()

  Returns value of P field from dictionary.

### getPerm

    public int getPerm()

  Returns permission bits in effect. If the password was the owner's, then this is identical to `PERM_ALL`; else if the password was the user's, then this is identical to the `/P` field; else if the password is invalid, then this is `PERM_NONE`. If a bit position is 1 according to `PERM_` bitmask, the user has that permission.

  See Also:
    `ContractualObligation`

### getKey

    public byte[] getKey()

  Description copied from class: `SecurityHandler`
  CryptFilter may take key from a security handler and use in Adobe algorithms.

  Specified by:
    `getKey` in class `SecurityHandler`

### encrypt

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

  Description copied from class: `SecurityHandler`
  Encrypts data of object objnum with generation gennum. Data is encrypted in place, which is to say the contents data are mutated.

  Specified by:
    `encrypt` in class `SecurityHandler`
  Returns:
    handle to encrypted data, which is same handle as the passed data.

### decrypt

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

  Description copied from class: `SecurityHandler`
  Decrypts stream data of object objnum with generation gennum. Data is decrypted in place, which is to say the contents data are mutated.

  Specified by:
    `decrypt` in class `SecurityHandler`
  Returns:
    handle to decrypted data, which is same handle as the passed data.

### isAuthorized

    public boolean isAuthorized()

  Description copied from class: `SecurityHandler`
  Returns true if a valid decryption password, either user or owner, been set?

  Specified by:
    `isAuthorized` in class `SecurityHandler`

### reset

    public SecurityHandler reset(int objnum,
                                 int gennum)

  Description copied from class: `SecurityHandler`
  Resets for decrypting/encrypting another subobject of object at given number.

  Specified by:
    `reset` in class `SecurityHandler`

### 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.

### computeKey

    public byte[] computeKey(java.lang.String password)

  Specified by:
    `computeKey` in class `SecurityHandler`

### computeKey

    public byte[] computeKey(java.lang.String password,
                             int keylen)

  Algorithm 3.2 Computing an encryption key.

### pad

    protected static byte[] pad(java.lang.String str)

  Algorithm 3.2, Step 1.

### computeO

    public java.lang.StringBuffer computeO(java.lang.String owner,
                                           java.lang.String user)

  Algorithm 3.3 Computing the encryption dictionary'’s O (owner password) value.

### computeU

    public java.lang.StringBuffer computeU(java.lang.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)

### authUser

    public boolean authUser(java.lang.String user)

  Algorithm 3.6 Authenticating the user password.

  Specified by:
    `authUser` in class `SecurityHandler`

### authOwner

    public boolean authOwner(java.lang.String owner)

  Algorithm 3.7 Authenticating the owner password.

  Specified by:
    `authOwner` in class `SecurityHandler`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD