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 getInstance()
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 CreateXMLSignatureRequest
object.
*
* @param keyIdentifier The identifier for the key group to use for signing.
* @param singleSignatureInfos A List
of
* SingleSignatureInfo
objects containing information about a
* single signature to be created.
* @return The CreateXMLSignatureRequest
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 SingleSignatureInfo
object.
*
* @param dataObjectInfos The data objects that will be signed (including
* transformations).
* @param createSignatureInfo Information about the signature environment. May
* be null
.
* @param securityLayerConform If true
, a Security Layer conform
* signature manifest is created, otherwise not.
* @return The SingleSignatureInfo
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 DataObjectInfo
object.
*
* @param structure The type of signature to create.
* @param childOfManifest If true
, 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 DataObjectInfo
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 CreateTransformsInfoProfile
object containing a
* reference to a locally stored profile.
*
* @param profileID The profile ID to resolve during signature creation.
* @return The CreateTransformsInfoProfile
containing the given
* profile ID.
*
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile(String profileID);
/**
* Create a new CreateTransformsInfoProfile
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
* null
.
* @return The CreateTransformsInfoProfile
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 CreateTransformsInfo
object.
*
* @param transforms The Transform
s to apply to the associated
* data object. May be null
.
* @param finalDataMetaInfo Information about the type of the transformed
* data.
* @return The CreateTransformsInfo
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 CreateSignatureInfo
object.
*
* @param createSignatureEnvironment The signature environment that will
* contain the signature.
* @param createSignatureEnvironmentProfile Additional information about
* the signture environment.
* @return The CreateSignatureInfo
containing the above data.
*
* @pre createSignatureEnvironment != null
* @pre createSignatureEnvironmentProfile != null
* @post return != null
*/
public abstract CreateSignatureInfo createCreateSignatureInfo(
Content createSignatureEnvironment,
CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile);
/**
* Create a new CreateSignatureEnvironmentProfile
object
* containing a reference to a locally stored profile.
*
* @param profileID The profile ID to resolve during signature creation.
* @return The CreateSignatureEnvironmentProfile
containing
* the given profile ID.
*
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(String profileID);
/**
* Create a new CreateSignatureEnvironmentProfile
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 CreateSignatureEnvironmentProfile
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 CreateSignatureLocation
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 CreateSignatureLocation
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 CreateXMLSignatureResponse
object.
*
* @param responseElements The elements of the response, either
* SignatureEnvironmentResponse
objects, or
* ErrorResponse
objects.
* @return The new CreateXMLSignatureResponse
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 SignatureEnvironmentResponse
object.
*
* @param signatureEnvironment The signature environment containing the
* signature.
* @return The SignatureEnvironmentResponse
containing the
* signatureEnvironment
.
*
* @pre signatureEnvironment != null
* @post return != null
*/
public abstract SignatureEnvironmentResponse createSignatureEnvironmentResponse(Element signatureEnvironment);
/**
* Create a new ErrorResponse
object.
*
* @param code The numerical error code.
* @param info Verbose error information.
* @return The new ErrorResponse
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 VerifyCMSSignatureRequest
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 null
.
* @param cmsSignature The CMS signature.
* @param dataObject The signed data. May be null
.
* @param trustProfileID The ID of the trust profile containing the trusted
* root certificates.
* @return The VerifyCMSSignatureRequest
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 CMSDataObject
object from data at a given URI.
*
* @param metaInfo Type information about the CMSDataObject
.
* May be null
.
* @param content The CMS content containing the data.
* @return The new CMSDataObject
containing the data.
*
* @pre referenceURI != null
* @pre content != null
* @post return != null
*/
public abstract CMSDataObject createCMSDataObject(
MetaInfo metaInfo,
CMSContent content);
/**
* Create a new CMSContent
object from the data contained at the
* given URI.
*
* @param referenceURI The URI identifying the data. Must be resolvable.
* @return The CMSContent
containing a reference to the signed
* data.
*
* @pre referenceURI != null
* @post return != null
*/
public abstract CMSContent createCMSContent(String referenceURI);
/**
* Create a new CMSContent
object from a byte stream.
*
* @param binaryContent The byte stream containing the signed data.
* @return The new CMSContent
containing the data from the
* byte stream.
*
* @pre binaryContent != null
* @post return != null
*/
public abstract CMSContent createCMSContent(InputStream binaryContent);
/**
* Create a new VerifyCMSSignatureResponse
object.
*
* @param responseElements Verification information about each signature.
* @return The new VerifyCMSSignatureResponse
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 VerifyCMSSignatureResponseElement
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 VerifyCMSSignatureResponseElement
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 VerifyXMLSignatureRequest
object.
*
* @param dateTime The date for which the verification is to be performed.
* May be null
.
* @param verifySignatureInfo Information about the signature environment and
* the location of the signature.
* @param supplementProfiles Supplemental information for the signature
* environment. May be null
.
* @param signatureManifestParams Additional information for checking the
* signature manifest. May be null
.
* @param returnHashInputData If true
, 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 VerifyXMLSignatureRequest
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 VerifySignatureInfo
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 VerifySignatureInfo
containing the above data.
*
* @pre verifySignatureEnvironment != null
* @pre verifySignatureLocation != null
* @post return != null
*/
public abstract VerifySignatureInfo createVerifySignatureInfo(
Content verifySignatureEnvironment,
VerifySignatureLocation verifySignatureLocation);
/**
* Create a new VerifySignatureLocation
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 VerifySignatureLocation
containing the above
* data.
*
* @pre xPathExpression != null
* @pre namespaceDeclarations != null
* @post return != null
*/
public abstract VerifySignatureLocation createVerifySignatureLocation(
String xPathExpression,
Map namespaceDeclarations);
/**
* Create a new SupplementProfile
object containing a reference
* to a locally stored profile.
*
* @param profileID The profile ID to resolve during signature verification.
* @return The SupplementProfile
containing the profile ID.
*
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract SupplementProfile createSupplementProfile(String profileID);
/**
* Create a new SupplementProfile
object by providing the profile
* data explicitly.
*
* @param supplementProfile The profile data.
* @return The SupplementProfile
containing the profile data.
*/
public abstract SupplementProfile createSupplementProfile(XMLDataObjectAssociation supplementProfile);
/**
* Create a new SignatureManifestCheckParams
object.
*
* @param referenceInfos Information for checking the validity of a
* a reference.
* @param returnReferenceInputData If true
, the input data to
* the calculation of reference digest values will be returned in the
* response, otherwise not.
* @return The SignatureManifestCheckParams
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 ReferenceInfo
object.
*
* @param verifyTransformsInfoProfiles The transformation profiles valid for
* the associated reference.
* @return The ReferenceInfo
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 VerifyTransformsInfoProfile
object containing
* a reference to a locally stored profile.
*
* @param profileID The profile ID to resolve during signature verification.
* @return The VerifyTransformsInfoProfile
containing the
* given profile ID.
*
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(String profileID);
/**
* Create a new VerifyTransformsInfoProfile
object by providing
* the profile data explicitly.
*
* @param transforms A valid chain of transformations for the reference.
* May be null
.
* @param transformParameters Additional transformation information.
* @return The VerifyTransformsInfoProfile
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 TransformParameter
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 TransformParameter
containing the URI of the
* data.
*
* @pre URI != null
* @post return != null
*/
public abstract TransformParameter createTransformParameter(String URI);
/**
* Creata a new TransformParameter
object containing the
* binary data.
*
* @param URI The URI identifying the data.
* @param binaryData The binary data.
* @return The TransformParameter
containig the binary data.
*
* @pre URI != null
* @pre binary != null
* @post return != null
*/
public abstract TransformParameter createTransformParameter(
String URI,
InputStream binaryData);
/**
* Create a new TransformParameter
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 TransformParameter
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 VerifyXMLSignatureResponse
object.
*
* @param signerInfo Information about the signer certificate.
* @param hashInputDatas The signed data objects. May be null
.
* @param referenceInputDatas The reference input data objects.
* May be null
.
* @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 VerifyXMLSignatureResponse
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 ReferencesCheckResult
object.
*
* @param code The status code.
* @param info Additional information about the reference check.
* @return The ReferencesCheckResult
containing the above data.
*
* @pre code >= 0
* @post return != null
*/
public abstract ReferencesCheckResult createReferencesCheckResult(
int code,
ReferencesCheckResultInfo info);
/**
* Create a new ReferencesCheckResultInfo
object.
*
* @param anyOtherInfo Arbitrary XML content describing the check result.
* May be null
.
* @param failedReferences The indexes of the failed references. May be
* null
.
* @return The ReferencesCheckResultInfo
containing the above
* data.
*
* @post return != null
*/
public abstract ReferencesCheckResultInfo createReferencesCheckResultInfo(
NodeList anyOtherInfo,
int[] failedReferences);
/**
* Create a new ManifestRefsCheckResult
object.
*
* @param code The status code.
* @param info Additional information about the manifest check. May be
* null
.
* @return The ManifestRefsCheckResult
containing the above
* data.
*
* @pre code >= 0
* @post return != null
*/
public abstract ManifestRefsCheckResult createManifestRefsCheckResult(
int code,
ManifestRefsCheckResultInfo info);
/**
* Create a new ManifestRefsCheckResultInfo
object.
*
* @param anyOtherInfo Arbitrary XML content describing the check result.
* May be null
.
* @param failedReferences The indexes of the failed references. May be
* null
.
* @param referringSigReference The index of the reference in the signature.
* @return The ManifestRefsCheckResultInfo
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 Content
object referencing data via a URI.
*
* @param referenceURI The URI pointing to the content.
* @return The Content
object containing the reference.
*
* @pre referenceURI != null && referenceURI.length() > 0
* @post return != null
*/
public abstract Content createContent(String referenceURI);
/**
* Create a new Content
object containing binary data.
*
* @param binaryData An InputStream
containing the binary data.
* @param referenceURI An URI identifying the data. May be null
.
* @return The Content
object containing the data.
*
* @pre binaryData != null
* @post return != null
*/
public abstract Content createContent(
InputStream binaryData,
String referenceURI);
/**
* Create a new Content
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 null
.
*
* @return The Content
object containing the data.
*
* @pre locationReferenceURI != null
* @post return != null
*/
public abstract Content createContent(
String locationReferenceURI,
String referenceURI);
/**
* Create a new Content
object containing XML data.
*
* @param xmlData The XML data contained in the new Content
.
* @param referenceURI An URI identifying the data. May be null
.
* @return The Content
object containing the data.
*
* @pre xmlData != null
* @post return != null
*/
public abstract Content createContent(NodeList xmlData, String referenceURI);
/**
* Create a new XMLDataObjectAssociation
object.
*
* @param metaInfo Information about the content type. May be
* null
.
* @param content The Content
object containing the data.
* @return The XMLDataObjectAssociation
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 MetaInfo
object.
*
* @param mimeType The MIME type part of the meta information.
* @param description Descriptive meta information. May be null
.
* @param otherInfo XML meta information. May be null
.
* @param type Type information for XML signature creation. May be null
.
* @return The MetaInfo
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 CanonicalizationTransform
type of Transform
.
*
* @param algorithmURI The algorithm URI of the canonicalization.
* @return The created CanonicalizationTransform
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 ExclusiveCanonicalizationTransform
type of
* Transform
.
*
* @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 ExclusiveCanonicalizationTransform
*
* @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 Base64Transform
type of Transform
.
*
* @return A Transform
denoting a Base64 decoding.
*
* @post return != null
*/
public abstract Transform createBase64Transform();
/**
* Create a EnvelopedSignatureTransform
type of
* Transform
.
*
* @return A Transform
denoting an enveloped signature.
*
* @post return != null
*/
public abstract Transform createEnvelopedSignatureTransform();
/**
* Create an XSLTTransform
type of Transform
.
*
* @param styleSheet The XSLT stylesheet contained in the
* Transform
.
* @return A Transform
containing the XSLT stylesheet.
*
* @post return != null
*/
public abstract Transform createXSLTTransform(Element styleSheet);
/**
* Create an XPathTransform
type of Transform
.
*
* @param xPathExpression The XPath expression to use in the created
* Transform
.
* @param namespaceDeclarations The namespace prefix to URI mapping to
* apply on evaluation of the XPath expression.
* @return The XPathTransform
containing the above data.
*
* @pre xPathExpression != null
* @pre namespaceDeclarations != null
* @post return != null
*/
public abstract Transform createXPathTransform(
String xPathExpression,
Map namespaceDeclarations);
/**
* Create a new XPathFilter2Transform
type of
* Transform
.
*
* @param xPathFilters The filters contained in the newly created
* XPathFilter2Transform
.
* @return The XPathFilter2Transform
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 XPathFilter
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 XPathFilter
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 CheckResult
object.
*
* @param code The check code.
* @param info Verbose information about the check. May be null
.
* @return The CheckResult
containing the above data.
*
* @pre code >= 0
* @post return != null
*/
public abstract CheckResult createCheckResult(int code, NodeList info);
/**
* Create a new SignerInfo
object.
*
* @param signerCertificate The signer certificate in binary form.
* @param qualifiedCertificate true
, if the signer certificate is
* a qualified certificate, otherwise false
.
* @param publicAuthority true
, if the signer certificate is a
* public authority certificate, otherwise false
.
* @param publicAuthorityID The identification of the public authority
* (if publicAuthority
is true
). May be
* null
.
* @return The SignerInfo
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 X509IssuerSerial
object.
*
* @param issuerName The distinguished name of the issuer.
* @param issuerSerial The certificate serial number.
* @return The X509IssuerSerial
containing the above data.
*
* @pre issuerName != null
* @pre issuerSerial != null
*/
public abstract X509IssuerSerial createX509IssuerSerial(
String issuerName,
BigInteger issuerSerial);
}