jPod PDF library

de.intarsys.pdf.crypt
Interface ISystemSecurityHandler

All Known Implementing Classes:
SystemSecurityHandler, SystemSecurityHandlerV0, SystemSecurityHandlerV1, SystemSecurityHandlerV2, SystemSecurityHandlerV3, SystemSecurityHandlerV4

public interface ISystemSecurityHandler

This object is responsible to manage the PDF documents security context and object de/encryption. It implements the security mechanics as described in the PDF spec up to revision 4.

The ISystemSecurityHandler dispatches de/encryption to either the standard ICryptHandler instances or (with /V 4 encryption) the ISecurityHandler installed.


Method Summary
 void attach(STDocument doc)
          Associate this ISystemSecurityHandler with a STDocument.
 void authenticate()
          Perform an authentication.
 byte[] decryptFile(COSObjectKey key, COSDictionary dict, byte[] bytes)
           
 byte[] decryptStream(COSObjectKey key, COSDictionary dict, byte[] bytes)
           
 byte[] decryptString(COSObjectKey key, byte[] bytes)
           
 void detach(STDocument doc)
          Disassociate this ISystemSecurityHandler from STDocument.
 byte[] encryptFile(COSObjectKey key, COSDictionary dict, byte[] bytes)
           
 byte[] encryptStream(COSObjectKey key, COSDictionary dict, byte[] bytes)
           
 byte[] encryptString(COSObjectKey key, byte[] bytes)
           
 COSCompositeObject getContextObject()
          The currently active container object in a read or write process.
 int getLength()
          The length of the encryption key in bits.
 ISecurityHandler getSecurityHandler()
          The associated pluggable ISecurityHandler.
 void initialize(STDocument doc)
          Initialize this ISystemSecurityHandler with a STDocument.
 COSCompositeObject popContextObject()
          Pop the topmost container.
 void pushContextObject(COSCompositeObject object)
          Push the current container.
 void setSecurityHandler(ISecurityHandler securityHandler)
          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.
 

Method Detail

attach

void attach(STDocument doc)
            throws COSSecurityException
Associate this ISystemSecurityHandler with a STDocument.

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

Parameters:
doc -
Throws:
COSSecurityException

authenticate

void authenticate()
                  throws COSSecurityException
Perform an authentication. Authentication is in all versions forwarded to the ISecurityHandler.

Throws:
COSSecurityException

decryptFile

byte[] decryptFile(COSObjectKey key,
                   COSDictionary dict,
                   byte[] bytes)
                   throws COSSecurityException
Throws:
COSSecurityException

decryptStream

byte[] decryptStream(COSObjectKey key,
                     COSDictionary dict,
                     byte[] bytes)
                     throws COSSecurityException
Throws:
COSSecurityException

decryptString

byte[] decryptString(COSObjectKey key,
                     byte[] bytes)
                     throws COSSecurityException
Throws:
COSSecurityException

detach

void detach(STDocument doc)
            throws COSSecurityException
Disassociate this ISystemSecurityHandler from STDocument.

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

Parameters:
systemSecurityHandler -
Throws:
COSSecurityException

encryptFile

byte[] encryptFile(COSObjectKey key,
                   COSDictionary dict,
                   byte[] bytes)
                   throws COSSecurityException
Throws:
COSSecurityException

encryptStream

byte[] encryptStream(COSObjectKey key,
                     COSDictionary dict,
                     byte[] bytes)
                     throws COSSecurityException
Throws:
COSSecurityException

encryptString

byte[] encryptString(COSObjectKey key,
                     byte[] bytes)
                     throws COSSecurityException
Throws:
COSSecurityException

getContextObject

COSCompositeObject getContextObject()
The currently active container object in a read or write process.

Returns:
The currently active container object.

getLength

int getLength()
The length of the encryption key in bits.

Returns:
The length of the encryption key in bits.

getSecurityHandler

ISecurityHandler getSecurityHandler()
The associated pluggable ISecurityHandler.

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

Returns:
The associated pluggable ISecurityHandler.

initialize

void initialize(STDocument doc)
                throws COSSecurityException
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.

Parameters:
systemSecurityHandler -
Throws:
COSSecurityException

popContextObject

COSCompositeObject popContextObject()
Pop the topmost container. This is called from the writer to "contextualize" the encryption process.

Returns:
The previously active container.

pushContextObject

void pushContextObject(COSCompositeObject object)
Push the current container. This is called from the writer to "contextualize" the encryption process.

Parameters:
object - The new active container.

setSecurityHandler

void setSecurityHandler(ISecurityHandler securityHandler)
                        throws COSSecurityException
Assign a new ISecurityHandler.

Parameters:
securityHandler - The new ISecurityHandler.
Throws:
COSSecurityException

stGetDoc

STDocument stGetDoc()
The associated STDocument.

Returns:
The associated STDocument.

updateTrailer

void updateTrailer(COSDictionary trailer)
Upon writing a new trailer dictionary is created and must be propagated to the ISystemSecurityHandler.

Parameters:
trailer -

jPod PDF library

Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.