jPod PDF library

de.intarsys.pdf.crypt
Class SystemSecurityHandler

java.lang.Object
  extended by de.intarsys.pdf.crypt.SystemSecurityHandler
All Implemented Interfaces:
ISystemSecurityHandler
Direct Known Subclasses:
SystemSecurityHandlerV0, SystemSecurityHandlerV1, SystemSecurityHandlerV2, SystemSecurityHandlerV3, SystemSecurityHandlerV4

public abstract class SystemSecurityHandler
extends Object
implements ISystemSecurityHandler

An abstract superclass for implementing the PDF security process.


Field Summary
static int DEFAULT_LENGTH
           
 
Method Summary
 void attach(STDocument stDoc)
          Associate this ISystemSecurityHandler with a STDocument.
 void authenticate()
          Perform an authentication.
 COSDictionary cosGetEncryption()
           
static SystemSecurityHandler createFromSt(STDocument doc)
           
static SystemSecurityHandler createNewV1()
           
static SystemSecurityHandler createNewV2()
           
static SystemSecurityHandler createNewV4()
           
 void detach(STDocument stDoc)
          Disassociate this ISystemSecurityHandler from STDocument.
 COSCompositeObject getContextObject()
          The currently active container object in a read or write process.
 COSEncryption getEncryption()
           
 int getLength()
          The length of the encryption key in bits.
 ISecurityHandler getSecurityHandler()
          The associated pluggable ISecurityHandler.
abstract  int getVersion()
           
 void initialize(STDocument doc)
          Initialize this ISystemSecurityHandler with a STDocument.
 COSCompositeObject popContextObject()
          Pop the topmost container.
 void pushContextObject(COSCompositeObject contextObject)
          Push the current container.
 void setLength(int length)
           
 void setSecurityHandler(ISecurityHandler pSecurityHandler)
          Assign a new ISecurityHandler.
 STDocument stGetDoc()
          The associated STDocument.
 void updateTrailer(COSDictionary trailer)
          Upon writing a new trailer dictionary is created and must be propagated to the ISystemSecurityHandler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.intarsys.pdf.crypt.ISystemSecurityHandler
decryptFile, decryptStream, decryptString, encryptFile, encryptStream, encryptString
 

Field Detail

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
See Also:
Constant Field Values
Method Detail

createFromSt

public static SystemSecurityHandler createFromSt(STDocument doc)
                                          throws COSSecurityException
Throws:
COSSecurityException

createNewV1

public static SystemSecurityHandler createNewV1()

createNewV2

public static SystemSecurityHandler createNewV2()

createNewV4

public static SystemSecurityHandler createNewV4()

attach

public void attach(STDocument stDoc)
            throws COSSecurityException
Description copied from interface: ISystemSecurityHandler
Associate this ISystemSecurityHandler with a STDocument.

The ISystemSecurityHandler should add all its private information to the document structure, in particular to the /Encrypt dictionary.

Specified by:
attach in interface ISystemSecurityHandler
Throws:
COSSecurityException

authenticate

public void authenticate()
                  throws COSSecurityException
Description copied from interface: ISystemSecurityHandler
Perform an authentication. Authentication is in all versions forwarded to the ISecurityHandler.

Specified by:
authenticate in interface ISystemSecurityHandler
Throws:
COSSecurityException

cosGetEncryption

public COSDictionary cosGetEncryption()

detach

public void detach(STDocument stDoc)
            throws COSSecurityException
Description copied from interface: ISystemSecurityHandler
Disassociate this ISystemSecurityHandler from STDocument.

The ISystemSecurityHandler should remove all its private information from the document structure, in particular from the /Encrypt dictionary.

Specified by:
detach in interface ISystemSecurityHandler
Throws:
COSSecurityException

getContextObject

public COSCompositeObject getContextObject()
Description copied from interface: ISystemSecurityHandler
The currently active container object in a read or write process.

Specified by:
getContextObject in interface ISystemSecurityHandler
Returns:
The currently active container object.

getEncryption

public COSEncryption getEncryption()

getLength

public int getLength()
Description copied from interface: ISystemSecurityHandler
The length of the encryption key in bits.

Specified by:
getLength in interface ISystemSecurityHandler
Returns:
The length of the encryption key in bits.

getSecurityHandler

public ISecurityHandler getSecurityHandler()
Description copied from interface: ISystemSecurityHandler
The associated pluggable ISecurityHandler.

By default this is one of the StandardSecurityHandler instances, implementing security behavior of the /Standard security defined in PDF spec.

Specified by:
getSecurityHandler in interface ISystemSecurityHandler
Returns:
The associated pluggable ISecurityHandler.

getVersion

public abstract int getVersion()

initialize

public void initialize(STDocument doc)
                throws COSSecurityException
Description copied from interface: ISystemSecurityHandler
Initialize this ISystemSecurityHandler with a STDocument.

The ISystemSecurityHandler should initialize its state from the information in the document structure, in particular from the /Encrypt dictionary.

Specified by:
initialize in interface ISystemSecurityHandler
Throws:
COSSecurityException

popContextObject

public COSCompositeObject popContextObject()
Description copied from interface: ISystemSecurityHandler
Pop the topmost container. This is called from the writer to "contextualize" the encryption process.

Specified by:
popContextObject in interface ISystemSecurityHandler
Returns:
The previously active container.

pushContextObject

public void pushContextObject(COSCompositeObject contextObject)
Description copied from interface: ISystemSecurityHandler
Push the current container. This is called from the writer to "contextualize" the encryption process.

Specified by:
pushContextObject in interface ISystemSecurityHandler
Parameters:
contextObject - The new active container.

setLength

public void setLength(int length)

setSecurityHandler

public void setSecurityHandler(ISecurityHandler pSecurityHandler)
                        throws COSSecurityException
Description copied from interface: ISystemSecurityHandler
Assign a new ISecurityHandler.

Specified by:
setSecurityHandler in interface ISystemSecurityHandler
Parameters:
pSecurityHandler - The new ISecurityHandler.
Throws:
COSSecurityException

stGetDoc

public STDocument stGetDoc()
Description copied from interface: ISystemSecurityHandler
The associated STDocument.

Specified by:
stGetDoc in interface ISystemSecurityHandler
Returns:
The associated STDocument.

updateTrailer

public void updateTrailer(COSDictionary trailer)
Description copied from interface: ISystemSecurityHandler
Upon writing a new trailer dictionary is created and must be propagated to the ISystemSecurityHandler.

Specified by:
updateTrailer in interface ISystemSecurityHandler

jPod PDF library

Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.