Class XAdESBuilder

java.lang.Object
eu.europa.esig.dss.xades.signature.XAdESBuilder
Direct Known Subclasses:
ExtensionBuilder, XAdESSignatureBuilder

public abstract class XAdESBuilder extends Object
Builds a XAdES signature
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
    Id-prefix for AnyValidationData element
    protected eu.europa.esig.dss.spi.validation.CertificateVerifier
    Reference to the object in charge of certificates validation
    protected Document
    This is the variable which represents the root XML document root (with signature).
    protected static final String
    Id-prefix for EncapsulatedTimeStamp element
    protected static final String
    Xml Id prefix
    This variable is a reference to the set of parameters relating to the structure and process of the creation or extension of the electronic signature.
    static final String
    The attribute used for timestamp includes
    static final String
    The qualifying properties target
    protected static final String
    Id-prefix for TimeStamp element
    protected static final String
    Id-prefix for TimeStampValidationData element
    static final String
    The URI attribute
    protected XAdESPath
    This variable holds the XAdESPaths which contains all constants and queries needed to cope with the default signature schema.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Empty constructor
    protected
    XAdESBuilder(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
    The default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    This method is used to align children indents
    protected eu.europa.esig.dss.model.DSSDocument
    Creates DSSDocument from the current documentDom
    protected XAdESElement
    Gets a relevant class containing the list of elements
    protected XAdESPath
    Gets a relevant class containing the list of paths
    protected eu.europa.esig.dss.xml.common.definition.DSSNamespace
    This method returns the current used XAdES 1.4.1 namespace
    protected eu.europa.esig.dss.xml.common.definition.DSSNamespace
    This method returns the current used XAdES namespace
    protected eu.europa.esig.dss.xml.common.definition.DSSNamespace
    This method returns the current used XMLDSig namespace
    protected Element
    incorporateCert(Element parentDom, eu.europa.esig.dss.model.x509.CertificateToken certificate, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    Creates Cert DOM object:
    protected void
    incorporateCertDigest(Element parentDom, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, eu.europa.esig.dss.model.x509.Token token)
    This method creates the xades:CertDigest DOM object.
    protected void
    incorporateDigestMethod(Element parentDom, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    This method creates the ds:DigestMethod DOM object.
    protected void
    incorporateDigestValue(Element parentDom, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, eu.europa.esig.dss.model.x509.Token token)
    This method creates the ds:DigestValue DOM object for a given Token
    protected void
    incorporateDigestValue(Element parentDom, String base64EncodedDigestBytes)
    This method creates the ds:DigestValue DOM object.
    protected void
    incorporateIssuerV1(Element parentDom, eu.europa.esig.dss.model.x509.CertificateToken certificate)
    Incorporates IssuerSerial element
    protected void
    incorporateIssuerV2(Element parentDom, eu.europa.esig.dss.model.x509.CertificateToken certificate)
    Incorporates IssuerSerialV2 element
    protected void
    incorporateSPDocSpecification(Element parentElement, eu.europa.esig.dss.model.SpDocSpecification spDocSpecification)
    Creates SpDocSpecification DOM object:
    protected String
    toXmlIdentifier(eu.europa.esig.dss.model.identifier.Identifier identifier)
    Transforms a DSS Identifier to an XML Id type

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • REFERENCED_DATA

      public static final String REFERENCED_DATA
      The attribute used for timestamp includes
      See Also:
    • TARGET

      public static final String TARGET
      The qualifying properties target
      See Also:
    • URI

      public static final String URI
      The URI attribute
      See Also:
    • ID_PREFIX

      protected static final String ID_PREFIX
      Xml Id prefix
      See Also:
    • TIMESTAMP_PREFIX

      protected static final String TIMESTAMP_PREFIX
      Id-prefix for TimeStamp element
      See Also:
    • ENCAPSULATED_TIMESTAMP_PREFIX

      protected static final String ENCAPSULATED_TIMESTAMP_PREFIX
      Id-prefix for EncapsulatedTimeStamp element
      See Also:
    • TST_VD_PREFIX

      protected static final String TST_VD_PREFIX
      Id-prefix for TimeStampValidationData element
      See Also:
    • ANY_VD_PREFIX

      protected static final String ANY_VD_PREFIX
      Id-prefix for AnyValidationData element
      See Also:
    • xadesPath

      protected XAdESPath xadesPath
      This variable holds the XAdESPaths which contains all constants and queries needed to cope with the default signature schema.
    • params

      protected XAdESSignatureParameters params
      This variable is a reference to the set of parameters relating to the structure and process of the creation or extension of the electronic signature.
    • documentDom

      protected Document documentDom
      This is the variable which represents the root XML document root (with signature).
    • certificateVerifier

      protected eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier
      Reference to the object in charge of certificates validation
  • Constructor Details

    • XAdESBuilder

      protected XAdESBuilder()
      Empty constructor
    • XAdESBuilder

      protected XAdESBuilder(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
      The default constructor.
      Parameters:
      certificateVerifier - CertificateVerifier
  • Method Details

    • incorporateCertDigest

      protected void incorporateCertDigest(Element parentDom, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, eu.europa.esig.dss.model.x509.Token token)
      This method creates the xades:CertDigest DOM object.
       
       		<CertDigest>
       	       <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
       	       <ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue>
       	    </CertDigest>
       
       
      Parameters:
      parentDom - the parent element
      digestAlgorithm - the digest algorithm to use
      token - the token to be digested
    • incorporateDigestMethod

      protected void incorporateDigestMethod(Element parentDom, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      This method creates the ds:DigestMethod DOM object.
       
       	   <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
       
       
      Parameters:
      parentDom - the parent element
      digestAlgorithm - the digest algorithm to use
    • incorporateDigestValue

      protected void incorporateDigestValue(Element parentDom, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, eu.europa.esig.dss.model.x509.Token token)
      This method creates the ds:DigestValue DOM object for a given Token
       
       	   <ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue>
       
       
      Parameters:
      parentDom - the parent element
      digestAlgorithm - the digest algorithm to use
      token - Token to compute Digest from
    • incorporateDigestValue

      protected void incorporateDigestValue(Element parentDom, String base64EncodedDigestBytes)
      This method creates the ds:DigestValue DOM object.
       
       	   <ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue>
       
       
      Parameters:
      parentDom - Element the parent element
      base64EncodedDigestBytes - String base64 encoded digest value
    • incorporateCert

      protected Element incorporateCert(Element parentDom, eu.europa.esig.dss.model.x509.CertificateToken certificate, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Creates Cert DOM object:
       
       		<Cert>
       			<CertDigest>
       				<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
       				<ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue>
       			</CertDigest>
       			<IssuerSerial>
       				<ds:X509IssuerName>CN=ICA A,O=DSS,C=AA</ds:X509IssuerName>
       				<ds:X509SerialNumber>4</ds:X509SerialNumber>
      			</IssuerSerial>
      		</Cert>
       
       
      Parameters:
      parentDom - the parent element
      certificate - the certificate to be added
      digestAlgorithm - DigestAlgorithm to use
      Returns:
      Element
    • incorporateIssuerV1

      protected void incorporateIssuerV1(Element parentDom, eu.europa.esig.dss.model.x509.CertificateToken certificate)
      Incorporates IssuerSerial element
      Parameters:
      parentDom - Element
      certificate - CertificateToken to get issuer for
    • incorporateIssuerV2

      protected void incorporateIssuerV2(Element parentDom, eu.europa.esig.dss.model.x509.CertificateToken certificate)
      Incorporates IssuerSerialV2 element
      Parameters:
      parentDom - Element
      certificate - CertificateToken to get issuer for
    • createXmlDocument

      protected eu.europa.esig.dss.model.DSSDocument createXmlDocument()
      Creates DSSDocument from the current documentDom
      Returns:
      DSSDocument
    • alignNodes

      protected abstract void alignNodes()
      This method is used to align children indents
    • getXmldsigNamespace

      protected eu.europa.esig.dss.xml.common.definition.DSSNamespace getXmldsigNamespace()
      This method returns the current used XMLDSig namespace
      Returns:
      DSSNamespace
    • getXadesNamespace

      protected eu.europa.esig.dss.xml.common.definition.DSSNamespace getXadesNamespace()
      This method returns the current used XAdES namespace
      Returns:
      DSSNamespace
    • getXades141Namespace

      protected eu.europa.esig.dss.xml.common.definition.DSSNamespace getXades141Namespace()
      This method returns the current used XAdES 1.4.1 namespace
      Returns:
      DSSNamespace
    • getCurrentXAdESElements

      protected XAdESElement getCurrentXAdESElements()
      Gets a relevant class containing the list of elements
      Returns:
      XAdESElement implementation
    • getCurrentXAdESPath

      protected XAdESPath getCurrentXAdESPath()
      Gets a relevant class containing the list of paths
      Returns:
      XAdESPath implementation
    • incorporateSPDocSpecification

      protected void incorporateSPDocSpecification(Element parentElement, eu.europa.esig.dss.model.SpDocSpecification spDocSpecification)
      Creates SpDocSpecification DOM object:
       
       	<xades141:SPDocSpecification xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#">
       	    <xades:Identifier>1.2.3.4.5</xades:Identifier>
       	</xades141:SPDocSpecification>
       
       
      Parameters:
      parentElement - Element element to create the new object inside
      spDocSpecification - SpDocSpecification
    • toXmlIdentifier

      protected String toXmlIdentifier(eu.europa.esig.dss.model.identifier.Identifier identifier)
      Transforms a DSS Identifier to an XML Id type
      Parameters:
      identifier - Identifier to transform
      Returns:
      String