org.icepdf.core.pobjects.security
Class SecurityHandler

java.lang.Object
  extended by org.icepdf.core.pobjects.security.SecurityHandler
All Implemented Interfaces:
SecurityHandlerInterface
Direct Known Subclasses:
StandardSecurityHandler

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

Defines common behaviors for Security Handlers.

Since:
1.1

Field Summary
protected  EncryptionDictionary encryptionDictionary
           
protected  java.lang.String handlerName
           
protected  Permissions permissions
           
 
Constructor Summary
SecurityHandler(EncryptionDictionary encryptionDictionary)
           
 
Method Summary
abstract  byte[] decrypt(Reference objectReference, byte[] encryptionKey, byte[] data)
          Decrypt the PDF data bytestream or string.
abstract  void dispose()
          Dispose of the security handler.
abstract  byte[] encrypt(Reference objectReference, byte[] encryptionKey, byte[] data)
          Encrypt the PDF data bytestream or string.
abstract  byte[] getDecryptionKey()
          Gets the encryption key used by the security handler for decryption data.
abstract  java.io.InputStream getEncryptionInputStream(Reference objectReference, byte[] encryptionKey, java.util.HashMap decodeparams, java.io.InputStream input)
           
abstract  byte[] getEncryptionKey()
          Gets the encryption key used by the security handler for encrypting data.
abstract  java.lang.String getHandlerName()
          Gets the name of the default security handler.
abstract  Permissions getPermissions()
          Gets the PDF permissions object associated with this document's security handler.
abstract  void init()
          Initiate the security handler
abstract  boolean isAuthorized(java.lang.String password)
          Determines whether the supplied password is authorized to view the PDF document.
abstract  boolean isOwnerAuthorized(java.lang.String password)
          Determines whether the supplied owner password is authorized to view the PDF document.
abstract  boolean isUserAuthorized(java.lang.String password)
          Determines whether the supplied user password is authorized to view the PDF document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handlerName

protected java.lang.String handlerName

encryptionDictionary

protected EncryptionDictionary encryptionDictionary

permissions

protected Permissions permissions
Constructor Detail

SecurityHandler

public SecurityHandler(EncryptionDictionary encryptionDictionary)
Method Detail

isAuthorized

public abstract boolean isAuthorized(java.lang.String password)
Description copied from interface: SecurityHandlerInterface
Determines whether the supplied password is authorized to view the PDF document. If a password is rejected, the user should be restricted from viewing the document.

Specified by:
isAuthorized in interface SecurityHandlerInterface
Parameters:
password - password to authorize
Returns:
true, if the password was authorized successfully; false, otherwise.

isUserAuthorized

public abstract boolean isUserAuthorized(java.lang.String password)
Description copied from interface: SecurityHandlerInterface
Determines whether the supplied user password is authorized to view the PDF document. If a password is rejected, the user should be restricted from viewing the document.

Specified by:
isUserAuthorized in interface SecurityHandlerInterface
Parameters:
password - password to authorize
Returns:
true, if the password was authorized successfully; false, otherwise.

isOwnerAuthorized

public abstract boolean isOwnerAuthorized(java.lang.String password)
Description copied from interface: SecurityHandlerInterface
Determines whether the supplied owner password is authorized to view the PDF document. If a password is rejected, the user should be restricted from viewing the document.

Specified by:
isOwnerAuthorized in interface SecurityHandlerInterface
Parameters:
password - password to authorize
Returns:
true, if the password was authorized successfully; false, otherwise.

encrypt

public abstract byte[] encrypt(Reference objectReference,
                               byte[] encryptionKey,
                               byte[] data)
Description copied from interface: SecurityHandlerInterface
Encrypt the PDF data bytestream or string.

Specified by:
encrypt in interface SecurityHandlerInterface
Parameters:
objectReference - reference to PDF object being encrypted; this object contains the PDF object number and revision.
encryptionKey - encryption key used by encryption algorithm.
data - byte data to be encrypted; either represents an object stream or string value.
Returns:
the encrypted stream or string byte data

decrypt

public abstract byte[] decrypt(Reference objectReference,
                               byte[] encryptionKey,
                               byte[] data)
Description copied from interface: SecurityHandlerInterface
Decrypt the PDF data bytestream or string.

Specified by:
decrypt in interface SecurityHandlerInterface
Parameters:
objectReference - reference to PDF object being encrypted; this object contains the PDF object number and revision.
encryptionKey - encryption key used by decryption algorithm.
data - byte data to be decrypted; either represents an object stream or string value.
Returns:
the decrypted stream or string byte data

getEncryptionInputStream

public abstract java.io.InputStream getEncryptionInputStream(Reference objectReference,
                                                             byte[] encryptionKey,
                                                             java.util.HashMap decodeparams,
                                                             java.io.InputStream input)
Specified by:
getEncryptionInputStream in interface SecurityHandlerInterface

getEncryptionKey

public abstract byte[] getEncryptionKey()
Description copied from interface: SecurityHandlerInterface
Gets the encryption key used by the security handler for encrypting data.

Specified by:
getEncryptionKey in interface SecurityHandlerInterface
Returns:
byte data representing encryption key

getDecryptionKey

public abstract byte[] getDecryptionKey()
Description copied from interface: SecurityHandlerInterface
Gets the encryption key used by the security handler for decryption data.

Specified by:
getDecryptionKey in interface SecurityHandlerInterface
Returns:
byte data representing encryption key

getHandlerName

public abstract java.lang.String getHandlerName()
Description copied from interface: SecurityHandlerInterface
Gets the name of the default security handler.

Specified by:
getHandlerName in interface SecurityHandlerInterface
Returns:
string representing security handler name

getPermissions

public abstract Permissions getPermissions()
Description copied from interface: SecurityHandlerInterface
Gets the PDF permissions object associated with this document's security handler.

Specified by:
getPermissions in interface SecurityHandlerInterface
Returns:
security handlers permissions object

init

public abstract void init()
Description copied from interface: SecurityHandlerInterface
Initiate the security handler

Specified by:
init in interface SecurityHandlerInterface

dispose

public abstract void dispose()
Description copied from interface: SecurityHandlerInterface
Dispose of the security handler.

Specified by:
dispose in interface SecurityHandlerInterface