Multivalent API

multivalent.std.adaptor.pdf
Class SecurityHandler

java.lang.Object
  extended by multivalent.std.adaptor.pdf.SecurityHandler
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
SecurityHandlerPublicKey, SecurityHandlerStandard

public abstract class SecurityHandler
extends java.lang.Object
implements java.lang.Cloneable

Superclass for PDF security handler implementations. Encryption applies to all strings and streams in the document's PDF file, but not to other object types.

Version:
$Revision: 1.6 $ $Date: 2003/08/17 08:40:17 $

Field Summary
static SecurityHandler IDENTITY
           
 
Constructor Summary
SecurityHandler(Dict edict, COSSource coss)
           
 
Method Summary
abstract  boolean authOwner(java.lang.String owner)
           
abstract  boolean authUser(java.lang.String user)
           
 java.lang.Object clone()
           
abstract  byte[] computeKey(java.lang.String password)
           
abstract  byte[] decrypt(byte[] data, int off, int len)
          Decrypts stream data of object objnum with generation gennum.
abstract  byte[] encrypt(byte[] data, int off, int len)
          Encrypts data of object objnum with generation gennum.
static SecurityHandler getInstance(java.lang.String filter, Dict shdict, COSSource coss)
          Constructor.newInstance(Object[]) for a description of the exceptions thrown.
abstract  byte[] getKey()
          CryptFilter may take key from a security handler and use in Adobe algorithms.
abstract  boolean isAuthorized()
          Returns true if a valid decryption password, either user or owner, been set?
static void register(java.lang.String filterName, java.lang.String className)
          Registers the security handler className, which must be a subclass of Encrypt, for filterName.
abstract  SecurityHandler reset(int objnum, int gennum)
          Resets for decrypting/encrypting another subobject of object at given number.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTITY

public static final SecurityHandler IDENTITY
Constructor Detail

SecurityHandler

public SecurityHandler(Dict edict,
                       COSSource coss)
Method Detail

register

public static void register(java.lang.String filterName,
                            java.lang.String className)
Registers the security handler className, which must be a subclass of Encrypt, for filterName. For example, Adobe's standard security handler is registered (automatically by the system), with the call register("Standard", "multivalent.std.adaptor.pdf.SecurityHandlerStandard").


getInstance

public static SecurityHandler getInstance(java.lang.String filter,
                                          Dict shdict,
                                          COSSource coss)
Constructor.newInstance(Object[]) for a description of the exceptions thrown.

Throws:
java.lang.UnsupportedOperationException - if filter not registered
java.lang.ClassNotFoundException - if class name registered to filter is not the CLASSPATH
ParseException - if can't read parameters for filter

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

authUser

public abstract boolean authUser(java.lang.String user)

authOwner

public abstract boolean authOwner(java.lang.String owner)

isAuthorized

public abstract boolean isAuthorized()
Returns true if a valid decryption password, either user or owner, been set?


computeKey

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

getKey

public abstract byte[] getKey()
CryptFilter may take key from a security handler and use in Adobe algorithms.


decrypt

public abstract byte[] decrypt(byte[] data,
                               int off,
                               int len)
Decrypts stream data of object objnum with generation gennum. Data is decrypted in place, which is to say the contents data are mutated.

Returns:
handle to decrypted data, which is same handle as the passed data.

encrypt

public abstract byte[] encrypt(byte[] data,
                               int off,
                               int len)
Encrypts data of object objnum with generation gennum. Data is encrypted in place, which is to say the contents data are mutated.

Returns:
handle to encrypted data, which is same handle as the passed data.

reset

public abstract SecurityHandler reset(int objnum,
                                      int gennum)
Resets for decrypting/encrypting another subobject of object at given number.


Multivalent API