diff options
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java')
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java | 1012 |
1 files changed, 0 insertions, 1012 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java deleted file mode 100644 index e306127b3..000000000 --- a/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ /dev/null @@ -1,1012 +0,0 @@ -package at.gv.egovernment.moa.spss.api; - -import java.io.InputStream; -import java.math.BigInteger; -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import org.apache.commons.discovery.tools.DiscoverClass; - -import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; -import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; -import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.Content; -import at.gv.egovernment.moa.spss.api.common.MetaInfo; -import at.gv.egovernment.moa.spss.api.common.SignerInfo; -import at.gv.egovernment.moa.spss.api.common.Transform; -import at.gv.egovernment.moa.spss.api.common.X509IssuerSerial; -import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; -import at.gv.egovernment.moa.spss.api.common.XPathFilter; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfile; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; -import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; -import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; -import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult; -import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; -import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; -import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile; -import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; - -/** - * An abstract factory for creating MOA SP/SS API objects. - * - * Use <code>getInstance()</code> to get a concrete factory instance. Using - * this instance, concrete MOA SP/SS API object can be created. - * - * @author Patrick Peck - * @author Gregor Karlinger - * @version $Id$ - */ -public abstract class SPSSFactory { - - /** The default implementation of this class. */ - private static final String DEFAULT_IMPLEMENTATION = - "at.gv.egovernment.moa.spss.api.impl.SPSSFactoryImpl"; - - /** The single instance of this class. */ - private static SPSSFactory instance = null; - - /** - * Returns the single instance of this class. - * - * @return The single instance of this class. - */ - public static synchronized SPSSFactory getInstance() { - if (instance == null) { - try { - DiscoverClass discover = new DiscoverClass(); - instance = - (SPSSFactory) discover.newInstance( - SPSSFactory.class, - DEFAULT_IMPLEMENTATION); - } catch (Exception e) { - // this can not happen since we provide a valid default - // implementation - } - } - return instance; - } - - // - // Factory methods for creating XML signatures - // - - /** - * Create a new <code>CreateXMLSignatureRequest</code> object. - * - * @param keyIdentifier The identifier for the key group to use for signing. - * @param singleSignatureInfos A <code>List</code> of - * <code>SingleSignatureInfo</code> objects containing information about a - * single signature to be created. - * @return The <code>CreateXMLSignatureRequest</code> containing the above - * data. - * - * @pre keyIdentifier != null && keyIdentifier.length() > 0 - * @pre singleSignatureInfos != null - * @pre forall Object o in singleSignatureInfos | - * o instanceof at.gv.egovernment.moa.spss.api.common.SingleSignatureInfo - * @post return != null - */ - public abstract CreateXMLSignatureRequest createCreateXMLSignatureRequest( - String keyIdentifier, - List singleSignatureInfos); - - /** - * Create a new <code>SingleSignatureInfo</code> object. - * - * @param dataObjectInfos The data objects that will be signed (including - * transformations). - * @param createSignatureInfo Information about the signature environment. May - * be <code>null</code>. - * @param securityLayerConform If <code>true</code>, a Security Layer conform - * signature manifest is created, otherwise not. - * @return The <code>SingleSignatureInfo</code> containing the above data. - * - * @pre dataObjectInfos != null && dataObjectInfos.size() > 0 - * @pre forall Object o in dataObjectInfos | - * o instanceof at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo - * @post return != null - */ - public abstract SingleSignatureInfo createSingleSignatureInfo( - List dataObjectInfos, - CreateSignatureInfo createSignatureInfo, boolean securityLayerConform); - - /** - * Create a new <code>DataObjectInfo</code> object. - * - * @param structure The type of signature to create. - * @param childOfManifest If <code>true</code>, references will be returned - * as children of an XMLDsig manifest. Otherwise, they will be returned as - * children of the signature itself. - * @param dataObject The data object that will be signed. - * @param createTransformsInfoProfile Additional transformations to apply - * to the data object. - * @return The <code>DataObjectInfo</code> containing the above data. - * - * @pre DataObjectInfo.STRUCTURE_DETACHED.equals(structure) || - * DataObjectInfo.STRUCTURE_ENVELOPING.equals(structure) - * @pre dataObject != null - * @pre createTransformsInfoProfile != null - * @post return != null - */ - public abstract DataObjectInfo createDataObjectInfo( - String structure, - boolean childOfManifest, - Content dataObject, - CreateTransformsInfoProfile createTransformsInfoProfile); - - /** - * Create a new <code>CreateTransformsInfoProfile</code> object containing a - * reference to a locally stored profile. - * - * @param profileID The profile ID to resolve during signature creation. - * @return The <code>CreateTransformsInfoProfile</code> containing the given - * profile ID. - * - * @pre profileID != null && profileID.length() > 0 - * @post return != null - */ - public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile(String profileID); - - /** - * Create a new <code>CreateTransformsInfoProfile</code> object by providing - * the profile data explicitly. - * - * @param transformsInfo The transformations to apply to the associated - * data object. - * @param supplements Supplemental information for the transformation. May be - * <code>null</code>. - * @return The <code>CreateTransformsInfoProfile</code> containing the above - * data. - * - * @pre transformsInfo != null - * @pre supplements != null implies - * forall Object o in supplements | - * o instanceof at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation - * @post return != null - */ - public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile( - CreateTransformsInfo transformsInfo, - List supplements); - - /** - * Create a new <code>CreateTransformsInfo</code> object. - * - * @param transforms The <code>Transform</code>s to apply to the associated - * data object. May be <code>null</code>. - * @param finalDataMetaInfo Information about the type of the transformed - * data. - * @return The <code>CreateTransformsInfo</code> containing the above data. - * - * @pre transforms != null implies transforms.size > 0 - * @pre transforms != null implies - * forall Object o in transforms | - * o instanceof at.gv.egovernment.moa.spss.api.common.Transform - * @pre finalDataMetaInfo != null - * @post return != null - */ - public abstract CreateTransformsInfo createCreateTransformsInfo( - List transforms, - MetaInfo finalDataMetaInfo); - - /** - * Create a new <code>CreateSignatureInfo</code> object. - * - * @param createSignatureEnvironment The signature environment that will - * contain the signature. - * @param createSignatureEnvironmentProfile Additional information about - * the signture environment. - * @return The <code>CreateSignatureInfo</code> containing the above data. - * - * @pre createSignatureEnvironment != null - * @pre createSignatureEnvironmentProfile != null - * @post return != null - */ - public abstract CreateSignatureInfo createCreateSignatureInfo( - Content createSignatureEnvironment, - CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile); - - /** - * Create a new <code>CreateSignatureEnvironmentProfile</code> object - * containing a reference to a locally stored profile. - * - * @param profileID The profile ID to resolve during signature creation. - * @return The <code>CreateSignatureEnvironmentProfile</code> containing - * the given profile ID. - * - * @pre profileID != null && profileID.length() > 0 - * @post return != null - */ - public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(String profileID); - - /** - * Create a new <code>CreateSignatureEnvironmentProfile</code> object by - * providing the profile data explicitly. - * - * @param createSignatureLocation The location where the signature will be - * inserted. - * @param supplements Additional information about the signature environment. - * @return The <code>CreateSignatureEnvironmentProfile</code> containing the - * above data. - * - * @pre createSignatureLocation != null - * @pre supplements != null - * @pre forall Object o in supplements | - * o instanceof at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation - * @post return != null - */ - public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile( - CreateSignatureLocation createSignatureLocation, - List supplements); - - /** - * Create a new <code>CreateSignatureLocation</code> object. - * - * @param xPathExpression The XPath expression to select the signature - * parent element within the signature environment. - * @param index The index of the node, after which the signature will be - * inserted. - * @param namespaceDeclarations The namespace prefix to URI mapping to apply - * while evaluating the XPath expression. - * @return The <code>CreateSignatureLocation</code> containing the above data. - * - * @pre xPathExpression != null - * @pre index >= 0 - * @pre namespaceDeclarations != null - */ - public abstract CreateSignatureLocation createCreateSignatureLocation( - String xPathExpression, - int index, - Map namespaceDeclarations); - - /** - * Create a new <code>CreateXMLSignatureResponse</code> object. - * - * @param responseElements The elements of the response, either - * <code>SignatureEnvironmentResponse</code> objects, or - * <code>ErrorResponse</code> objects. - * @return The new <code>CreateXMLSignatureResponse</code> containing the - * above data. - * - * @pre responseElements != null && responseElements.size() > 0 - * @pre forall Object o in responseElements | - * o instanceof at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureResponseElement - * @post return != null - */ - public abstract CreateXMLSignatureResponse createCreateXMLSignatureResponse(List responseElements); - - /** - * Create a new <code>SignatureEnvironmentResponse</code> object. - * - * @param signatureEnvironment The signature environment containing the - * signature. - * @return The <code>SignatureEnvironmentResponse</code> containing the - * <code>signatureEnvironment</code>. - * - * @pre signatureEnvironment != null - * @post return != null - */ - public abstract SignatureEnvironmentResponse createSignatureEnvironmentResponse(Element signatureEnvironment); - - /** - * Create a new <code>ErrorResponse</code> object. - * - * @param code The numerical error code. - * @param info Verbose error information. - * @return The new <code>ErrorResponse</code> containing the above data. - * - * @pre code > 0 - * @pre info != null - * @post return != null - */ - public abstract ErrorResponse createErrorResponse(int code, String info); - - // - // Factory methods for verifying CMS signatures - // - - /** - * Create a new <code>VerifyCMSSignatureRequest</code> object. - * - * @param signatories The indexes of the signatories whose signature is to - * be verified. - * @param dateTime The date for which the verification is to be performed. - * May be <code>null</code>. - * @param cmsSignature The CMS signature. - * @param dataObject The signed data. May be <code>null</code>. - * @param trustProfileID The ID of the trust profile containing the trusted - * root certificates. - * @return The <code>VerifyCMSSignatureRequest</code> containing the above - * data. - * - * @pre signatories != null && signatories.length > 0 - * @pre signaturies != VerifyCMSSignatureRequest.ALL_SIGNATORIES implies - * for (int i = 0; i < signatories.length; i++) - * signatories[i] >= 1 - * @pre cmsSignature != null - * @pre trustProfileID != null && trustProfileID.length() > 0 - * @post return != null - */ - public abstract VerifyCMSSignatureRequest createVerifyCMSSignatureRequest( - int[] signatories, - Date dateTime, - InputStream cmsSignature, - CMSDataObject dataObject, - String trustProfileID); - - /** - * Create a new <code>CMSDataObject</code> object from data at a given URI. - * - * @param metaInfo Type information about the <code>CMSDataObject</code>. - * May be <code>null</code>. - * @param content The CMS content containing the data. - * @return The new <code>CMSDataObject</code> containing the data. - * - * @pre referenceURI != null - * @pre content != null - * @post return != null - */ - public abstract CMSDataObject createCMSDataObject( - MetaInfo metaInfo, - CMSContent content); - - /** - * Create a new <code>CMSContent</code> object from the data contained at the - * given URI. - * - * @param referenceURI The URI identifying the data. Must be resolvable. - * @return The <code>CMSContent</code> containing a reference to the signed - * data. - * - * @pre referenceURI != null - * @post return != null - */ - public abstract CMSContent createCMSContent(String referenceURI); - - /** - * Create a new <code>CMSContent</code> object from a byte stream. - * - * @param binaryContent The byte stream containing the signed data. - * @return The new <code>CMSContent</code> containing the data from the - * byte stream. - * - * @pre binaryContent != null - * @post return != null - */ - public abstract CMSContent createCMSContent(InputStream binaryContent); - - /** - * Create a new <code>VerifyCMSSignatureResponse</code> object. - * - * @param responseElements Verification information about each signature. - * @return The new <code>VerifyCMSSignatureResponse</code> containing the - * status of signature verification for each signature contained in the - * request. - * - * @pre responseElements != null && responseElements.size() > 0 - * @pre forall Object o in responseElements | - * o instanceof at.gv.egovernment.moa.spss.api.cmssign.VerifyCMSSignatureResponseElement - * @post return != null - */ - public abstract VerifyCMSSignatureResponse createVerifyCMSSignatureResponse(List responseElements); - - /** - * Create a new <code>VerifyCMSSignatureResponseElement</code> object. - * - * @param signerInfo Information about the signer certificate. - * @param signatureCheck Result of the singature value check. - * @param certificateCheck Result of the certificate status check. - * @return The new <code>VerifyCMSSignatureResponseElement</code> containing - * the above data. - * - * @pre signerInfo != null && signatureCheck != null && - * certificateCheck != null - * @post return != null - */ - public abstract VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( - SignerInfo signerInfo, - CheckResult signatureCheck, - CheckResult certificateCheck); - - // - // Factory methods for verifying XML signatures - // - - /** - * Create a new <code>VerifyXMLSignatureRequest</code> object. - * - * @param dateTime The date for which the verification is to be performed. - * May be <code>null</code>. - * @param verifySignatureInfo Information about the signature environment and - * the location of the signature. - * @param supplementProfiles Supplemental information for the signature - * environment. May be <code>null</code>. - * @param signatureManifestParams Additional information for checking the - * signature manifest. May be <code>null</code>. - * @param returnHashInputData If <code>true</code>, hash input data will - * be returned in the response, otherwise not. - * @param trustProfileID The ID of the trust profile containing the trusted - * root certificates. - * @return The new <code>VerifyXMLSignatureRequest</code> containing the - * above data. - * - * @pre verifySignatureInfo != null - * @pre supplementProfiles != null implies - * forall Object o in supplementProfiles | - * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile - * @pre trustProfileID != null && trustProfileID.length() > 0 - * @post return != null - */ - public abstract VerifyXMLSignatureRequest createVerifyXMLSignatureRequest( - Date dateTime, - VerifySignatureInfo verifySignatureInfo, - List supplementProfiles, - SignatureManifestCheckParams signatureManifestParams, - boolean returnHashInputData, - String trustProfileID); - - /** - * Create a new <code>VerifySignatureInfo</code> object. - * - * @param verifySignatureEnvironment The signature environment containing - * the signature to be verified. - * @param verifySignatureLocation The location of the signature within the - * signature environment. - * @return The new <code>VerifySignatureInfo</code> containing the above data. - * - * @pre verifySignatureEnvironment != null - * @pre verifySignatureLocation != null - * @post return != null - */ - public abstract VerifySignatureInfo createVerifySignatureInfo( - Content verifySignatureEnvironment, - VerifySignatureLocation verifySignatureLocation); - - /** - * Create a new <code>VerifySignatureLocation</code> object. - * - * @param xPathExpression The XPath expression to select the signature - * element within the signature environment. - * @param namespaceDeclarations The namespace prefix to URI mapping to apply - * while evaluating the XPath expression. - * @return The new <code>VerifySignatureLocation</code> containing the above - * data. - * - * @pre xPathExpression != null - * @pre namespaceDeclarations != null - * @post return != null - */ - public abstract VerifySignatureLocation createVerifySignatureLocation( - String xPathExpression, - Map namespaceDeclarations); - - /** - * Create a new <code>SupplementProfile</code> object containing a reference - * to a locally stored profile. - * - * @param profileID The profile ID to resolve during signature verification. - * @return The <code>SupplementProfile</code> containing the profile ID. - * - * @pre profileID != null && profileID.length() > 0 - * @post return != null - */ - public abstract SupplementProfile createSupplementProfile(String profileID); - - /** - * Create a new <code>SupplementProfile</code> object by providing the profile - * data explicitly. - * - * @param supplementProfile The profile data. - * @return The <code>SupplementProfile</code> containing the profile data. - */ - public abstract SupplementProfile createSupplementProfile(XMLDataObjectAssociation supplementProfile); - - /** - * Create a new <code>SignatureManifestCheckParams</code> object. - * - * @param referenceInfos Information for checking the validity of a - * a reference. - * @param returnReferenceInputData If <code>true</code>, the input data to - * the calculation of reference digest values will be returned in the - * response, otherwise not. - * @return The <code>SignatureManifestCheckParams</code> containing the - * above data. - * - * @pre referenceInfos != null && referenceInfos.size() > 0 - * @pre forall Object o in referenceInfos | - * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo - * @post return != null - */ - public abstract SignatureManifestCheckParams createSignatureManifestCheckParams( - List referenceInfos, - boolean returnReferenceInputData); - - /** - * Create a new <code>ReferenceInfo</code> object. - * - * @param verifyTransformsInfoProfiles The transformation profiles valid for - * the associated reference. - * @return The <code>ReferenceInfo</code> containing the transformation - * profiles. - * - * @pre verifyTransformsInfoProfiles != null && - * verifyTransformsInfoProfiles.size() > 0 - * @pre forall Object o in verifyTransformsInfoProfiles | - * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile - * @post return != null - */ - public abstract ReferenceInfo createReferenceInfo(List verifyTransformsInfoProfiles); - - /** - * Create a new <code>VerifyTransformsInfoProfile</code> object containing - * a reference to a locally stored profile. - * - * @param profileID The profile ID to resolve during signature verification. - * @return The <code>VerifyTransformsInfoProfile</code> containing the - * given profile ID. - * - * @pre profileID != null && profileID.length() > 0 - * @post return != null - */ - public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(String profileID); - - /** - * Create a new <code>VerifyTransformsInfoProfile</code> object by providing - * the profile data explicitly. - * - * @param transforms A valid chain of transformations for the reference. - * May be <code>null</code>. - * @param transformParameters Additional transformation information. - * @return The <code>VerifyTransformsInfoProfile</code> containing the above - * data. - * - * @pre transforms != null implies - * (transforms.size() > 0 && - * forall Object o in transforms | o instanceof Transform) - * @pre transformParameters != null implies - * forall Object o in transformParameters | - * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter - * @post return != null - */ - public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile( - List transforms, - List transformParameters); - - /** - * Create a new <code>TransformParameter</code> object with the data - * contained at the given URI. - * - * @param URI The URI identifying the data. The URI will be resolved during - * signature verification. - * @return The <code>TransformParameter</code> containing the URI of the - * data. - * - * @pre URI != null - * @post return != null - */ - public abstract TransformParameter createTransformParameter(String URI); - - /** - * Creata a new <code>TransformParameter</code> object containing the - * binary data. - * - * @param URI The URI identifying the data. - * @param binaryData The binary data. - * @return The <code>TransformParameter</code> containig the binary data. - * - * @pre URI != null - * @pre binary != null - * @post return != null - */ - public abstract TransformParameter createTransformParameter( - String URI, - InputStream binaryData); - - /** - * Create a new <code>TransformParameter</code> object containing the hash - * value of the transformation data. - * - * @param URI The URI identifying the data. It will be resolved during - * signature verification. - * @param digestMethod The digest method used for calculating the digest - * value. - * @param digestValue The hash value of the transformation data. - * @return The <code>TransformParameter</code> containing the above data. - * - * @pre URI != null - * @pre digestMethod != null - * @pre digestValue != null - */ - public abstract TransformParameter createTransformParameter( - String URI, - String digestMethod, - byte[] digestValue); - - /** - * Create a new <code>VerifyXMLSignatureResponse</code> object. - * - * @param signerInfo Information about the signer certificate. - * @param hashInputDatas The signed data objects. May be <code>null</code>. - * @param referenceInputDatas The reference input data objects. - * May be <code>null</code>. - * @param signatureCheck Status information about the signature check. - * @param signatureManifestCheck Status information about the signature - * manifest check. - * @param xmlDsigManifestChecks Status information about each XMLDsig manifest - * check. - * @param certificateCheck Status information about the signer certificate - * check. - * @return The <code>VerifyXMLSignatureResponse</code> containing the above - * data. - * - * @pre signerInfo != null - * @pre hashInputDatas != null implies - * forall Object o in hashInputDatas | - * o instanceof at.gv.egovernment.moa.spss.api.common.Content - * @pre referenceInputDatas != null implies - * forall Object o in referenceInputDatas | - * o instanceof at.gv.egovernment.moa.spss.api.common.Content - * @pre signatureCheck != null - * @pre xmlDsigManifestChecks != null implies - * forall Object o in xmlDsigManifestChecks | - * o instanceof at.gv.egovernment.moa.spss.api.xmlverifyManifestRefsCheckResult - * @pre certificateCheck != null - * @post return != null - */ - public abstract VerifyXMLSignatureResponse createVerifyXMLSignatureResponse( - SignerInfo signerInfo, - List hashInputDatas, - List referenceInputDatas, - ReferencesCheckResult signatureCheck, - ReferencesCheckResult signatureManifestCheck, - List xmlDsigManifestChecks, - CheckResult certificateCheck); - - /** - * Create a new <code>ReferencesCheckResult</code> object. - * - * @param code The status code. - * @param info Additional information about the reference check. - * @return The <code>ReferencesCheckResult</code> containing the above data. - * - * @pre code >= 0 - * @post return != null - */ - public abstract ReferencesCheckResult createReferencesCheckResult( - int code, - ReferencesCheckResultInfo info); - - /** - * Create a new <code>ReferencesCheckResultInfo</code> object. - * - * @param anyOtherInfo Arbitrary XML content describing the check result. - * May be <code>null</code>. - * @param failedReferences The indexes of the failed references. May be - * <code>null</code>. - * @return The <code>ReferencesCheckResultInfo</code> containing the above - * data. - * - * @post return != null - */ - public abstract ReferencesCheckResultInfo createReferencesCheckResultInfo( - NodeList anyOtherInfo, - int[] failedReferences); - - /** - * Create a new <code>ManifestRefsCheckResult</code> object. - * - * @param code The status code. - * @param info Additional information about the manifest check. May be - * <code>null</code>. - * @return The <code>ManifestRefsCheckResult</code> containing the above - * data. - * - * @pre code >= 0 - * @post return != null - */ - public abstract ManifestRefsCheckResult createManifestRefsCheckResult( - int code, - ManifestRefsCheckResultInfo info); - - /** - * Create a new <code>ManifestRefsCheckResultInfo</code> object. - * - * @param anyOtherInfo Arbitrary XML content describing the check result. - * May be <code>null</code>. - * @param failedReferences The indexes of the failed references. May be - * <code>null</code>. - * @param referringSigReference The index of the reference in the signature. - * @return The <code>ManifestRefsCheckResultInfo</code> containing the - * above data. - * - * @pre referringSigReference > 0 - * @post return != null - */ - public abstract ManifestRefsCheckResultInfo createManifestRefsCheckResultInfo( - NodeList anyOtherInfo, - int[] failedReferences, - int referringSigReference); - - // - // Factory methods for common objects - // - - /** - * Create a new <code>Content</code> object referencing data via a URI. - * - * @param referenceURI The URI pointing to the content. - * @return The <code>Content</code> object containing the reference. - * - * @pre referenceURI != null && referenceURI.length() > 0 - * @post return != null - */ - public abstract Content createContent(String referenceURI); - - /** - * Create a new <code>Content</code> object containing binary data. - * - * @param binaryData An <code>InputStream</code> containing the binary data. - * @param referenceURI An URI identifying the data. May be <code>null</code>. - * @return The <code>Content</code> object containing the data. - * - * @pre binaryData != null - * @post return != null - */ - public abstract Content createContent( - InputStream binaryData, - String referenceURI); - - /** - * Create a new <code>Content</code> object containing location reference data. - * - * @param locationReferenceURI a URI pointing to the actual remote location of the content. - * - * @param referenceURI An URI identifying the data. May be <code>null</code>. - * - * @return The <code>Content</code> object containing the data. - * - * @pre locationReferenceURI != null - * @post return != null - */ - public abstract Content createContent( - String locationReferenceURI, - String referenceURI); - - /** - * Create a new <code>Content</code> object containing XML data. - * - * @param xmlData The XML data contained in the new <code>Content</code>. - * @param referenceURI An URI identifying the data. May be <code>null</code>. - * @return The <code>Content</code> object containing the data. - * - * @pre xmlData != null - * @post return != null - */ - public abstract Content createContent(NodeList xmlData, String referenceURI); - - /** - * Create a new <code>XMLDataObjectAssociation</code> object. - * - * @param metaInfo Information about the content type. May be - * <code>null</code>. - * @param content The <code>Content</code> object containing the data. - * @return The <code>XMLDataObjectAssociation</code> containing the above - * data. - * - * @pre content != null - * @pre content.getContentType() == Content.CONTENT_XML || - * content.getContentType() == Contetn.CONTENT_BINARY - * @pre content.getReference() != null - * @post return != null - */ - public abstract XMLDataObjectAssociation createXMLDataObjectAssociation( - MetaInfo metaInfo, - Content content); - - /** - * Create a new <code>MetaInfo</code> object. - * - * @param mimeType The MIME type part of the meta information. - * @param description Descriptive meta information. May be <code>null</code>. - * @param otherInfo XML meta information. May be <code>null</code>. - * @param type Type information for XML signature creation. May be <code>null</code>. - * @return The <code>MetaInfo</code> object containing the above data. - * - * @pre mimeType != null && mimeType.length() > 0 - * @pre otherInfo != null implies - * forall Node n in otherInfo | n.getNodeType() == Node.ELEMENT - */ - public abstract MetaInfo createMetaInfo( - String mimeType, - String description, - NodeList otherInfo, - String type); - - /** - * Create a <code>CanonicalizationTransform</code> type of <code>Transform</code>. - * - * @param algorithmURI The algorithm URI of the canonicalization. - * @return The created <code>CanonicalizationTransform</code> object. - * - * @pre CanonicalizationTransform.CANONICAL_XML.equals(algorithmURI) || - * CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(algorithmURI) - * @post return != null - */ - public abstract Transform createCanonicalizationTransform(String algorithmURI); - - /** - * Create an <code>ExclusiveCanonicalizationTransform</code> type of - * <code>Transform</code>. - * - * @param algorithmURI The algorithm URI of the exclusive canonicalization. - * @param inclusiveNamespacePrefixes The prefixes of the namespaces to - * treat according to canonical XML. - * @return The new <code>ExclusiveCanonicalizationTransform</code> - * - * @pre ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(algorithmURI) || - * ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS.equals(algorithmURI) - * @pre inclusiveNamespacePrefixes != null - * @pre forall Object o in inclusiveNamespacePrefixes | o instanceof String - * @post return != null - */ - public abstract Transform createExclusiveCanonicalizationTransform( - String algorithmURI, - List inclusiveNamespacePrefixes); - - /** - * Create a <code>Base64Transform</code> type of <code>Transform</code>. - * - * @return A <code>Transform</code> denoting a Base64 decoding. - * - * @post return != null - */ - public abstract Transform createBase64Transform(); - - /** - * Create a <code>EnvelopedSignatureTransform</code> type of - * <code>Transform</code>. - * - * @return A <code>Transform</code> denoting an enveloped signature. - * - * @post return != null - */ - public abstract Transform createEnvelopedSignatureTransform(); - - /** - * Create an <code>XSLTTransform</code> type of <code>Transform</code>. - * - * @param styleSheet The XSLT stylesheet contained in the - * <code>Transform</code>. - * @return A <code>Transform</code> containing the XSLT stylesheet. - * - * @post return != null - */ - public abstract Transform createXSLTTransform(Element styleSheet); - - /** - * Create an <code>XPathTransform</code> type of <code>Transform</code>. - * - * @param xPathExpression The XPath expression to use in the created - * <code>Transform</code>. - * @param namespaceDeclarations The namespace prefix to URI mapping to - * apply on evaluation of the XPath expression. - * @return The <code>XPathTransform</code> containing the above data. - * - * @pre xPathExpression != null - * @pre namespaceDeclarations != null - * @post return != null - */ - public abstract Transform createXPathTransform( - String xPathExpression, - Map namespaceDeclarations); - - /** - * Create a new <code>XPathFilter2Transform</code> type of - * <code>Transform</code>. - * - * @param xPathFilters The filters contained in the newly created - * <code>XPathFilter2Transform</code>. - * @return The <code>XPathFilter2Transform</code> containing the given - * filters. - * - * @pre xPathFilters != null && - * forall Object o in xPathFilters | - * o instanceof at.gv.egovernment.moa.spss.api.common.XPathFilter - * @post return != null - */ - public abstract Transform createXPathFilter2Transform(List xPathFilters); - - /** - * Create a new <code>XPathFilter</code> object. - * - * @param filterType The type of filter. - * @param xPathExpression The XPath expression contained in this filter. - * @param namespaceDeclarations The namespace prefix to URI mapping to apply - * on evaluation of the XPath expression. - * @return The <code>XPathFilter</code> containing the above data. - * - * @pre XPathFilter.SUBTRACT_TYPE.equals(filterType) || - * XPathFilter.INTERSECT_TYPE.equals(filterType) || - * XPathFilter.UNION_TYPE.equals(filterType) - * @pre xPathExpression != null - * @pre namespaceDeclarations != null - * @post return != null - */ - public abstract XPathFilter createXPathFilter( - String filterType, - String xPathExpression, - Map namespaceDeclarations); - - /** - * Create a new <code>CheckResult</code> object. - * - * @param code The check code. - * @param info Verbose information about the check. May be <code>null</code>. - * @return The <code>CheckResult</code> containing the above data. - * - * @pre code >= 0 - * @post return != null - */ - public abstract CheckResult createCheckResult(int code, NodeList info); - - /** - * Create a new <code>SignerInfo</code> object. - * - * @param signerCertificate The signer certificate in binary form. - * @param qualifiedCertificate <code>true</code>, if the signer certificate is - * a qualified certificate, otherwise <code>false</code>. - * @param publicAuthority <code>true</code>, if the signer certificate is a - * public authority certificate, otherwise <code>false</code>. - * @param publicAuthorityID The identification of the public authority - * (if <code>publicAuthority</code> is <code>true</code>). May be - * <code>null</code>. - * @return The <code>SignerInfo</code> containing the above data. - * - * @pre signerCertSubjectName != null - * @pre signerCertIssuerSerial != null - * @pre signerCertificate != null - */ - public abstract SignerInfo createSignerInfo( - X509Certificate signerCertificate, - boolean qualifiedCertificate, - boolean publicAuthority, - String publicAuthorityID); - - /** - * Create a new <code>X509IssuerSerial</code> object. - * - * @param issuerName The distinguished name of the issuer. - * @param issuerSerial The certificate serial number. - * @return The <code>X509IssuerSerial</code> containing the above data. - * - * @pre issuerName != null - * @pre issuerSerial != null - */ - public abstract X509IssuerSerial createX509IssuerSerial( - String issuerName, - BigInteger issuerSerial); - -} |