at.gv.egiz.pdfas.impl.api
Class PdfAsObject

java.lang.Object
  extended by at.gv.egiz.pdfas.impl.api.PdfAsObject
All Implemented Interfaces:
PdfAs

public class PdfAsObject
extends Object
implements PdfAs

Implementation of the PdfAs interface.

Author:
wprinz

Field Summary
static float DEFAULT_SIGNATURE_BLOCK_WIDTH_THRESHOLD
          Minimal signature block width.
 
Constructor Summary
PdfAsObject()
          This constructor is for internal use only - use PdfAsFactory instead.
PdfAsObject(File workDirectory)
          This constructor is for internal use only - use PdfAsFactory instead.
PdfAsObject(File workDirectory, boolean registerProvider)
          This constructor is for internal use only - use PdfAsFactory instead.
 
Method Summary
 AnalyzeResult analyze(AnalyzeParameters analyzeParameters)
          Analyzes a document for signatures and returns a verify-able list of such.
 DynamicSignatureProfile createDynamicSignatureProfile(String parentProfile, DynamicSignatureLifetimeEnum mode)
          Create a signature profile dynamically.
 DynamicSignatureProfile createDynamicSignatureProfile(String myUniqueName, String parentProfile, DynamicSignatureLifetimeEnum mode)
          Create a signature profile dynamically.
 DynamicSignatureProfile createEmptyDynamicSignatureProfile(DynamicSignatureLifetimeEnum mode)
          Create a signature profile dynamically.
 DynamicSignatureProfile createEmptyDynamicSignatureProfile(String myUniqueName, DynamicSignatureLifetimeEnum mode)
          Create a signature profile dynamically.
protected  void fillAnalyzeParametersWithReconstructXMLDsigParameters(AnalyzeParameters ap, ReconstructXMLDsigParameters rxp)
           
protected  void fillAnalyzeParametersWithVerifyParameters(AnalyzeParameters ap, VerifyParameters vp)
          Copies all adequate parameters from the VerifyParameters to the AnalyzeParameters.
protected  void fillReconstructXMLDsigAfterAnalysisParametersWithVerifyAfterAnalysisParameters(ReconstructXMLDsigAfterAnalysisParameters reconstructParams, VerifyAfterAnalysisParameters verifyAfterAnalysisParameters)
           
protected  void fillVerifyAfterAnalysisParametersWithVerifyParameters(VerifyAfterAnalysisParameters vaap, VerifyParameters vp)
          Copies all adequate parameters from the VerifyParameters to the VerifyAfterAnalysisParameters.
protected  void fillVerifyAfterReconstructXMLDsigParametersWithVerifyAfterAnalysisParameters(VerifyAfterReconstructXMLDsigParameters varxp, VerifyAfterAnalysisParameters verifyAfterAnalysisParameters)
           
 SignResult finishSign(SignParameters signParameters, SignatureDetailInformation signatureDetailInformation)
          Finish the signature process.
 List getProfileInformation()
          Returns the list of information objects about activated profiles available in the configuration.
 DynamicSignatureProfile loadDynamicSignatureProfile(String name)
          Loads an existing dynamic signature profile by its name.
 SignatureDetailInformation prepareSign(SignParameters signParameters)
          Prepares the signature of the given PDF document.
 ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigAfterAnalysisParameters reconstructXMLDsigParameters)
          Reconstruct the from the given parameters.
 ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigParameters reconstructXMLDsigParameters)
          Reconstruct the from the given parameters.
 void reloadConfig()
          Reloads the configuration from the work directory.
 SignResult sign(SignParameters signParameters)
          Signs a PDF document using PDF-AS.
 SignResult sign(SignParameters signParameters, SignatureDetailInformation signatorInfo)
          Signs a PDF document using PDF-AS.
 VerifyResults verify(VerifyAfterAnalysisParameters verifyAfterAnalysisParameters)
          Verifies a list of signatures that have been analyzed previously.
 VerifyResults verify(VerifyAfterReconstructXMLDsigParameters verifyAfterReconstructXMLDsigParameters)
          Verifies a list of signatures that have been analyzed previously and the xmldsigs have been reconstructed.
 VerifyResults verify(VerifyParameters verifyParameters)
          Verifies a document with (potentially multiple) PDF-AS signatures.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIGNATURE_BLOCK_WIDTH_THRESHOLD

public static final float DEFAULT_SIGNATURE_BLOCK_WIDTH_THRESHOLD
Minimal signature block width. If a width below that value is defined (by parameter, by placeholder or by configuration) a warning log entry is created.

See Also:
Constant Field Values
Constructor Detail

PdfAsObject

public PdfAsObject(File workDirectory)
            throws PdfAsException
This constructor is for internal use only - use PdfAsFactory instead. Note: IAIK JCE and IAIK ECC security providers are automatically registered.

Parameters:
workDirectory - The work directory.
Throws:
PdfAsException - Thrown, if the configuration cannot be processed.

PdfAsObject

public PdfAsObject(File workDirectory,
                   boolean registerProvider)
            throws PdfAsException
This constructor is for internal use only - use PdfAsFactory instead.

Parameters:
workDirectory - The work directory.
registerProvider - true: automatically registers IAIK JCE and ECC Provider; false: providers will NOT be automatically registered, providers needed have to be registered by the API user
Throws:
PdfAsException - Thrown, if the configuration cannot be processed.

PdfAsObject

public PdfAsObject()
            throws PdfAsException
This constructor is for internal use only - use PdfAsFactory instead. Note: IAIK JCE and IAIK ECC security providers are automatically registered.

Throws:
PdfAsException - Thrown, if the configuration cannot be processed.
Method Detail

reloadConfig

public void reloadConfig()
                  throws PdfAsException
Description copied from interface: PdfAs
Reloads the configuration from the work directory.

Specified by:
reloadConfig in interface PdfAs
Throws:
PdfAsException - Thrown, if an error occurs.
See Also:
PdfAs.reloadConfig()

getProfileInformation

public List getProfileInformation()
                           throws PdfAsException
Description copied from interface: PdfAs
Returns the list of information objects about activated profiles available in the configuration.

Note: Currently the profile information consists of the profile Id and the MOA Key Id only.

Note: In near future the profile management will be moved out of the config file into an API class representation of the profiles which may render this (and related) methods obsolete.

Specified by:
getProfileInformation in interface PdfAs
Returns:
Returns the list of SignatureProfile objects with information about active profiles available in the configuration.
Throws:
PdfAsException - Thrown on error.
See Also:
PdfAs.getProfileInformation()

sign

public SignResult sign(SignParameters signParameters)
                throws PdfAsException
Description copied from interface: PdfAs
Signs a PDF document using PDF-AS.

Specified by:
sign in interface PdfAs
Parameters:
signParameters - The sign parameters.
Returns:
Returns the signed document plus additional information.
Throws:
PdfAsException - Thrown, if an error occurs.
See Also:
PdfAs.sign(at.gv.egiz.pdfas.api.sign.SignParameters)

verify

public VerifyResults verify(VerifyParameters verifyParameters)
                     throws PdfAsException
Description copied from interface: PdfAs
Verifies a document with (potentially multiple) PDF-AS signatures.

Specified by:
verify in interface PdfAs
Parameters:
verifyParameters - The verify parameters.
Returns:
Returns the verification results.
Throws:
PdfAsException - Thrown, if an error occurs.
See Also:
PdfAs.verify(at.gv.egiz.pdfas.api.verify.VerifyParameters)

fillAnalyzeParametersWithVerifyParameters

protected void fillAnalyzeParametersWithVerifyParameters(AnalyzeParameters ap,
                                                         VerifyParameters vp)
Copies all adequate parameters from the VerifyParameters to the AnalyzeParameters.

Parameters:
ap - The AnalyzeParameters.
vp - The VerifyParameters.

fillAnalyzeParametersWithReconstructXMLDsigParameters

protected void fillAnalyzeParametersWithReconstructXMLDsigParameters(AnalyzeParameters ap,
                                                                     ReconstructXMLDsigParameters rxp)

fillVerifyAfterAnalysisParametersWithVerifyParameters

protected void fillVerifyAfterAnalysisParametersWithVerifyParameters(VerifyAfterAnalysisParameters vaap,
                                                                     VerifyParameters vp)
Copies all adequate parameters from the VerifyParameters to the VerifyAfterAnalysisParameters.

Parameters:
vaap - The VerifyAfterAnalysisParameters.
vp - The VerifyParameters.

fillReconstructXMLDsigAfterAnalysisParametersWithVerifyAfterAnalysisParameters

protected void fillReconstructXMLDsigAfterAnalysisParametersWithVerifyAfterAnalysisParameters(ReconstructXMLDsigAfterAnalysisParameters reconstructParams,
                                                                                              VerifyAfterAnalysisParameters verifyAfterAnalysisParameters)

analyze

public AnalyzeResult analyze(AnalyzeParameters analyzeParameters)
                      throws PdfAsException
Description copied from interface: PdfAs
Analyzes a document for signatures and returns a verify-able list of such.

Specified by:
analyze in interface PdfAs
Parameters:
analyzeParameters - The analyzation parameters.
Returns:
Returns a list of verify-able signatures that were found in the document.
Throws:
PdfAsException - Thrown on error.
See Also:
PdfAs.analyze(at.gv.egiz.pdfas.api.analyze.AnalyzeParameters)

verify

public VerifyResults verify(VerifyAfterAnalysisParameters verifyAfterAnalysisParameters)
                     throws PdfAsException
Description copied from interface: PdfAs
Verifies a list of signatures that have been analyzed previously.

Specified by:
verify in interface PdfAs
Parameters:
verifyAfterAnalysisParameters - The parameters.
Returns:
Returns the verification results.
Throws:
PdfAsException - Thrown on error.
See Also:
PdfAs.verify(at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters)

fillVerifyAfterReconstructXMLDsigParametersWithVerifyAfterAnalysisParameters

protected void fillVerifyAfterReconstructXMLDsigParametersWithVerifyAfterAnalysisParameters(VerifyAfterReconstructXMLDsigParameters varxp,
                                                                                            VerifyAfterAnalysisParameters verifyAfterAnalysisParameters)

reconstructXMLDSIG

public ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigParameters reconstructXMLDsigParameters)
                                            throws PdfAsException
Description copied from interface: PdfAs
Reconstruct the from the given parameters.

Specified by:
reconstructXMLDSIG in interface PdfAs
Parameters:
reconstructXMLDsigParameters - The data from which to reconstruct the xmldsig
Returns:
a list of xmldsigs, one for each signature in the document
Throws:
PdfAsException - if the reconstruction fails
See Also:
PdfAs.reconstructXMLDSIG(ReconstructXMLDsigParameters)

reconstructXMLDSIG

public ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigAfterAnalysisParameters reconstructXMLDsigParameters)
                                            throws PdfAsException
Description copied from interface: PdfAs
Reconstruct the from the given parameters.

Specified by:
reconstructXMLDSIG in interface PdfAs
Parameters:
reconstructXMLDsigParameters - The data from which to reconstruct the xmldsigs
Returns:
a list of xmldsigs, one for each signature in the document
Throws:
PdfAsException
See Also:
PdfAs.reconstructXMLDSIG(ReconstructXMLDsigAfterAnalysisParameters)

verify

public VerifyResults verify(VerifyAfterReconstructXMLDsigParameters verifyAfterReconstructXMLDsigParameters)
                     throws PdfAsException
Description copied from interface: PdfAs
Verifies a list of signatures that have been analyzed previously and the xmldsigs have been reconstructed.

Specified by:
verify in interface PdfAs
Parameters:
verifyAfterReconstructXMLDsigParameters - The parameters.
Returns:
the verification results.
Throws:
PdfAsException - Thrown on error.
See Also:
PdfAs.verify(VerifyAfterReconstructXMLDsigParameters)

createDynamicSignatureProfile

public DynamicSignatureProfile createDynamicSignatureProfile(String parentProfile,
                                                             DynamicSignatureLifetimeEnum mode)
Description copied from interface: PdfAs
Create a signature profile dynamically. You have do apply() it for usage. See SignatureProfile.

Specified by:
createDynamicSignatureProfile in interface PdfAs
Parameters:
parentProfile - a parent profile id to inherit all properties
mode - lifetime mode
Returns:
the created signature profile to work with.

createEmptyDynamicSignatureProfile

public DynamicSignatureProfile createEmptyDynamicSignatureProfile(DynamicSignatureLifetimeEnum mode)
Description copied from interface: PdfAs
Create a signature profile dynamically. You have fill it with properties and apply() it for usage. See SignatureProfile.
It is recommended to use PdfAs.createDynamicSignatureProfile(String, DynamicSignatureLifetimeEnum) that inherits from an existing profile saving you a lot of work.

Specified by:
createEmptyDynamicSignatureProfile in interface PdfAs
Parameters:
mode - lifetime mode
Returns:
the created signature profile to work with.
See Also:
DynamicSignatureProfile

loadDynamicSignatureProfile

public DynamicSignatureProfile loadDynamicSignatureProfile(String name)
Description copied from interface: PdfAs
Loads an existing dynamic signature profile by its name. Profiles are saved when they are applied and it has DynamicSignatureLifetimeEnum.MANUAL

Specified by:
loadDynamicSignatureProfile in interface PdfAs
Returns:
the signature profile or null if not found.
See Also:
DynamicSignatureProfile

createDynamicSignatureProfile

public DynamicSignatureProfile createDynamicSignatureProfile(String myUniqueName,
                                                             String parentProfile,
                                                             DynamicSignatureLifetimeEnum mode)
Description copied from interface: PdfAs
Create a signature profile dynamically. You have to provide a unique name and have do apply() it for usage. See SignatureProfile. It is recommended to use PdfAs.createDynamicSignatureProfile(String, DynamicSignatureLifetimeEnum) that generates a unique name on its own.

Specified by:
createDynamicSignatureProfile in interface PdfAs
Parameters:
myUniqueName - a unique name for the profile
parentProfile - a parent profile id to inherit all properties
mode - lifetime mode
Returns:
the created signature profile to work with.
See Also:
DynamicSignatureProfile

createEmptyDynamicSignatureProfile

public DynamicSignatureProfile createEmptyDynamicSignatureProfile(String myUniqueName,
                                                                  DynamicSignatureLifetimeEnum mode)
Description copied from interface: PdfAs
Create a signature profile dynamically. You have fill it with properties and apply() it for usage. See SignatureProfile.
It is recommended to use PdfAs.createDynamicSignatureProfile(String, DynamicSignatureLifetimeEnum) that inherits from an existing profile saving you a lot of work.

Specified by:
createEmptyDynamicSignatureProfile in interface PdfAs
Parameters:
myUniqueName - a unique name for the profile
mode - lifetime mode
Returns:
the created signature profile to work with.

prepareSign

public SignatureDetailInformation prepareSign(SignParameters signParameters)
                                       throws PdfAsException
Description copied from interface: PdfAs
Prepares the signature of the given PDF document. The table for the signature data is placed but not filled.
Usually used for preview.

Specified by:
prepareSign in interface PdfAs
Parameters:
signParameters - The sign parameters.
Returns:
Only the SignatureDetailInformation.getSignaturePosition(), SignatureDetailInformation.getNonTextualObjects(), SignatureDetailInformation.getSignatureData() are filled.
Throws:
PdfAsException - if something goes wrong during the process
See Also:
PdfAs.prepareSign(SignParameters)

sign

public SignResult sign(SignParameters signParameters,
                       SignatureDetailInformation signatorInfo)
                throws PdfAsException
Description copied from interface: PdfAs
Signs a PDF document using PDF-AS.
This uses the SignatorInformation which was obtained by a call to PdfAs.prepareSign(SignParameters)

Specified by:
sign in interface PdfAs
Parameters:
signParameters - The sign parameters.
signatorInfo - The signature information which was previously obtained by a call to PdfAs.prepareSign(SignParameters)
Returns:
Returns the signed document plus additional information.
Throws:
PdfAsException - Thrown, if an error occurs.
See Also:
SignParameters, SignResult

finishSign

public SignResult finishSign(SignParameters signParameters,
                             SignatureDetailInformation signatureDetailInformation)
                      throws PdfAsException
Description copied from interface: PdfAs
Finish the signature process. The PDF is filled with the signature data.
Usually used if some steps like the actual signing are to be performed externally.

Specified by:
finishSign in interface PdfAs
Parameters:
signParameters - The sign parameters.
signatureDetailInformation - The signature detail information.
Returns:
Throws:
PdfAsException


Copyright © 2006-2011. All Rights Reserved.