intarsys PDF library API

de.intarsys.pdf.crypt
Class StandardSecurityHandler

java.lang.Object
  extended by de.intarsys.pdf.crypt.AbstractSecurityHandler
      extended by de.intarsys.pdf.crypt.StandardSecurityHandler
All Implemented Interfaces:
ICryptHandler, ISecurityHandler
Direct Known Subclasses:
StandardSecurityHandlerR2, StandardSecurityHandlerR3, StandardSecurityHandlerR4

public abstract class StandardSecurityHandler
extends AbstractSecurityHandler

The standard security handler as specified in the PDF reference.

It supports the implementation up to and including revision 4.


Field Summary
static int DEFAULT_ACCESS_PERMISSIONS
          The default value for the access permission flags.
static COSName DK_EncryptMetadata
           
static COSName DK_O
           
static COSName DK_P
           
static COSName DK_R
           
static COSName DK_U
           
 
Constructor Summary
StandardSecurityHandler()
           
 
Method Summary
 void authenticate(IPasswordProvider passwordProvider)
          Perform an authentication of the current "user" on behalf of the information in the encryption dictionary.
 byte[] decrypt(COSObjectKey key, byte[] bytes)
          Decrypt any bytes in the context of COSObject referenced by the provided key.
 byte[] encrypt(COSObjectKey key, byte[] bytes)
          Encrypt any bytes in the context of COSObject referenced by the provided key.
 IAccessPermissions getAccessPermissions()
          The access permissions encoded in the encryption object for the current document or null if not applicable.
 byte[] getCryptKey()
           
 void init(STDocument document, COSEncryption encryption)
           
 
Methods inherited from class de.intarsys.pdf.crypt.AbstractSecurityHandler
getEncryption
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DK_O

public static final COSName DK_O

DK_P

public static final COSName DK_P

DK_R

public static final COSName DK_R

DK_U

public static final COSName DK_U

DK_EncryptMetadata

public static final COSName DK_EncryptMetadata

DEFAULT_ACCESS_PERMISSIONS

public static final int DEFAULT_ACCESS_PERMISSIONS
The default value for the access permission flags.

Everything is allowed, only the reserved flags are zero.

See Also:
Constant Field Values
Constructor Detail

StandardSecurityHandler

public StandardSecurityHandler()
Method Detail

authenticate

public void authenticate(IPasswordProvider passwordProvider)
                  throws COSSecurityException
Description copied from interface: ISecurityHandler
Perform an authentication of the current "user" on behalf of the information in the encryption dictionary.

In most situations this will consist of checking user/owner password and setting the resulting access permissions.

Throws:
COSSecurityException

getAccessPermissions

public IAccessPermissions getAccessPermissions()
Description copied from interface: ISecurityHandler
The access permissions encoded in the encryption object for the current document or null if not applicable.

The access permissions are not standardized, may be these are not available from arbitrary handlers.

Returns:
The access permissions encoded in the encryption object for the current document or null if not applicable.

getCryptKey

public byte[] getCryptKey()

init

public void init(STDocument document,
                 COSEncryption encryption)
          throws COSSecurityException
Specified by:
init in interface ISecurityHandler
Overrides:
init in class AbstractSecurityHandler
Throws:
COSSecurityException

decrypt

public byte[] decrypt(COSObjectKey key,
                      byte[] bytes)
               throws COSSecurityException
Description copied from interface: ICryptHandler
Decrypt any bytes in the context of COSObject referenced by the provided key.

Parameters:
key - of the object which provides the context
bytes - to decrypt
Returns:
the decrypted bytes
Throws:
COSSecurityException

encrypt

public byte[] encrypt(COSObjectKey key,
                      byte[] bytes)
               throws COSSecurityException
Description copied from interface: ICryptHandler
Encrypt any bytes in the context of COSObject referenced by the provided key.

Parameters:
key - of the object which provides the context
bytes - to decrypt
Returns:
the encrypted bytes
Throws:
COSSecurityException

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.