Class XAdESSignatureParameters

java.lang.Object
eu.europa.esig.dss.model.AbstractSerializableSignatureParameters<TP>
eu.europa.esig.dss.AbstractSignatureParameters<XAdESTimestampParameters>
eu.europa.esig.dss.xades.XAdESSignatureParameters
All Implemented Interfaces:
eu.europa.esig.dss.model.SerializableSignatureParameters, Serializable
Direct Known Subclasses:
XAdESCounterSignatureParameters

public class XAdESSignatureParameters extends eu.europa.esig.dss.AbstractSignatureParameters<XAdESTimestampParameters>
Defines SignatureParameters to deal with XAdES signature creation/extension
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enumeration defining ways to embed a signature
  • Field Summary

    Fields inherited from class eu.europa.esig.dss.AbstractSignatureParameters

    context

    Fields inherited from class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters

    archiveTimestampParameters, contentTimestampParameters, signatureTimestampParameters
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor instantiating object with null values
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    Gets the signature creation context (internal variable)
    Gets a list of custom xades:DataObjectFormat elements
    Returns the canonicalization algorithm used for dealing with KeyInfo
    Gets the list of custom ds:Object elements
    Returns a list of references to be incorporated to the signature
    Returns the root document for INTERNALLY_DETACHED signature creation
     
    byte[]
    Gets a custom XAdES Object content
    Gets the SignedInfo canonicalization algorithm
    Gets the SignedProperties canonicalization algorithm
    eu.europa.esig.dss.enumerations.DigestAlgorithm
    eu.europa.esig.dss.enumerations.DigestAlgorithm
    Gets a DigestAlgorithm to create CompleteCertificateRefs/CompleteRevocationRefs with
    eu.europa.esig.dss.xml.common.definition.DSSNamespace
    This method returns the current used XAdES 1.4.1 namespace Never returns null
    eu.europa.esig.dss.xml.common.definition.DSSNamespace
    This method returns the current used XAdES namespace Never returns null
    eu.europa.esig.dss.xml.common.definition.DSSNamespace
    This method returns the current used XMLDSig namespace Never returns null
    Returns the XPath element placement for Enveloped signature creation
    Gets the xPath signature location string (ENVELOPED only)
    boolean
    Gets if the <ds:X509Data> element shall be added
    boolean
    Gets if the signed content shall be incorporated as XML (used for ENVELOPING)
    boolean
    Gets if the signature shall be created according to ETSI EN 319 132
    boolean
    Gets if the signature signs a manifest
    boolean
    Gets if the signature shall be pretty-printed
    boolean
    Returns value value specifying if "KeyInfo" element should be signed.
    void
     
    void
    setAddX509SubjectName(boolean addX509SubjectName)
    Sets if the <ds:X509Data> element shall be added Default: false
    void
    Sets a list of custom xades:DataObjectFormat elements to be incorporated within xades:SignedDataObjectProperties element of the signature.
    void
    setEmbedXML(boolean embedXML)
    Sets if the signed content shall be incorporated as XML (used for ENVELOPING) If false, incorporates the document content in its base64 encoded representation Default: false (base64 encoded binaries)
    void
    setEn319132(boolean en319132)
    Sets if the signature shall be created according to ETSI EN 319 132 Default: true
    void
    setKeyInfoCanonicalizationMethod(String keyInfoCanonicalizationMethod)
    Set the canonicalization algorithm used for dealing with KeyInfo.
    void
    setManifestSignature(boolean manifestSignature)
    Sets if the signature signs a manifest
    void
    Sets the list of custom ds:Object elements to be incorporated within the ds:Signature
    void
    setPrettyPrint(boolean prettyPrint)
    Sets if the signature shall be pretty-printed Default: false
    void
    Sets a list of references to be incorporated into the signature NOTE: This method overwrites a default behavior on ds:Reference's creation.
    void
    setRootDocument(Document rootDocument)
    Sets the root document for INTERNALLY_DETACHED signature creation
    void
    setSignatureLevel(eu.europa.esig.dss.enumerations.SignatureLevel signatureLevel)
     
    void
    setSignedAdESObject(byte[] signedAdESObject)
    Sets a custom XAdES Object content
    void
    setSignedInfoCanonicalizationMethod(String signedInfoCanonicalizationMethod)
    Set the canonicalization algorithm to be used when dealing with SignedInfo.
    void
    setSignedPropertiesCanonicalizationMethod(String signedPropertiesCanonicalizationMethod)
    Set the canonicalization algorithm to be used when dealing with SignedProperties.
    void
    setSigningCertificateDigestMethod(eu.europa.esig.dss.enumerations.DigestAlgorithm signingCertificateDigestMethod)
    This property is a part of the standard:
    7.2.2 The SigningCertificate element (101 903 V1.4.2 (2010-12) XAdES)
    The digest method indicates the digest algorithm to be used to calculate the CertDigest element that contains the digest for each certificate referenced in the sequence.
    void
    setSignKeyInfo(boolean signKeyInfo)
    Set the parameter SignKeyInfo defining if the "KeyInfo" element must be signed and its reference must be included to "SignedInfo" element.
    void
    setTokenReferencesDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm tokenReferencesDigestAlgorithm)
    Sets a DigestAlgorithm to create CompleteCertificateRefs/CompleteRevocationRefs for -C level Default : SHA256
    void
    setXades141Namespace(eu.europa.esig.dss.xml.common.definition.DSSNamespace xades141Namespace)
    Sets the XAdES 1.4.1 namespace Default: xades141:http://uri.etsi.org/01903/v1.4.1#
    void
    setXadesNamespace(eu.europa.esig.dss.xml.common.definition.DSSNamespace xadesNamespace)
    Sets the XAdES namespace Default: xades:http://uri.etsi.org/01903/v1.3.2#
    void
    setXmldsigNamespace(eu.europa.esig.dss.xml.common.definition.DSSNamespace xmldsigNamespace)
    Sets the XMLDSIG namespace Default: ds:http://www.w3.org/2000/09/xmldsig#
    void
    Defines the relation to the element referenced by the XPath where the signature will be added (XAdES Enveloped)
    void
    setXPathLocationString(String xPathLocationString)
    Defines the position where the signature will be added (XAdES Enveloped)

    Methods inherited from class eu.europa.esig.dss.AbstractSignatureParameters

    getCertificateChain, getContentTimestamps, getDetachedContents, getDeterministicId, getSignedData, getSigningCertificate, setCertificateChain, setCertificateChain, setContentTimestamps, setDetachedContents, setSignedData, setSigningCertificate

    Methods inherited from class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters

    bLevel, equals, getDigestAlgorithm, getEncryptionAlgorithm, getMaskGenerationFunction, getReferenceDigestAlgorithm, getSignatureAlgorithm, getSignatureLevel, getSignaturePackaging, hashCode, isCheckCertificateRevocation, isGenerateTBSWithoutCertificate, isSignWithExpiredCertificate, isSignWithNotYetValidCertificate, setArchiveTimestampParameters, setBLevelParams, setCheckCertificateRevocation, setContentTimestampParameters, setDigestAlgorithm, setEncryptionAlgorithm, setGenerateTBSWithoutCertificate, setMaskGenerationFunction, setReferenceDigestAlgorithm, setSignaturePackaging, setSignatureTimestampParameters, setSignWithExpiredCertificate, setSignWithNotYetValidCertificate, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • XAdESSignatureParameters

      public XAdESSignatureParameters()
      Default constructor instantiating object with null values
  • Method Details

    • setSignatureLevel

      public void setSignatureLevel(eu.europa.esig.dss.enumerations.SignatureLevel signatureLevel)
      Overrides:
      setSignatureLevel in class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters<XAdESTimestampParameters>
    • setSigningCertificateDigestMethod

      public void setSigningCertificateDigestMethod(eu.europa.esig.dss.enumerations.DigestAlgorithm signingCertificateDigestMethod)
      This property is a part of the standard:
      7.2.2 The SigningCertificate element (101 903 V1.4.2 (2010-12) XAdES)
      The digest method indicates the digest algorithm to be used to calculate the CertDigest element that contains the digest for each certificate referenced in the sequence.
      Parameters:
      signingCertificateDigestMethod - DigestAlgorithm
    • getSigningCertificateDigestMethod

      public eu.europa.esig.dss.enumerations.DigestAlgorithm getSigningCertificateDigestMethod()
      Returns:
      DigestAlgorithm
    • getSignedInfoCanonicalizationMethod

      public String getSignedInfoCanonicalizationMethod()
      Gets the SignedInfo canonicalization algorithm
      Returns:
      the canonicalization algorithm to be used when dealing with SignedInfo.
    • setSignedInfoCanonicalizationMethod

      public void setSignedInfoCanonicalizationMethod(String signedInfoCanonicalizationMethod)
      Set the canonicalization algorithm to be used when dealing with SignedInfo.
      Parameters:
      signedInfoCanonicalizationMethod - the canonicalization algorithm to be used when dealing with SignedInfo.
    • getSignedPropertiesCanonicalizationMethod

      public String getSignedPropertiesCanonicalizationMethod()
      Gets the SignedProperties canonicalization algorithm
      Returns:
      the canonicalization algorithm to be used when dealing with SignedProperties.
    • setSignedPropertiesCanonicalizationMethod

      public void setSignedPropertiesCanonicalizationMethod(String signedPropertiesCanonicalizationMethod)
      Set the canonicalization algorithm to be used when dealing with SignedProperties.
      Parameters:
      signedPropertiesCanonicalizationMethod - the canonicalization algorithm to be used when dealing with SignedInfo.
    • getKeyInfoCanonicalizationMethod

      public String getKeyInfoCanonicalizationMethod()
      Returns the canonicalization algorithm used for dealing with KeyInfo
      Returns:
      - name of the canonicalization algorithm
    • setKeyInfoCanonicalizationMethod

      public void setKeyInfoCanonicalizationMethod(String keyInfoCanonicalizationMethod)
      Set the canonicalization algorithm used for dealing with KeyInfo.
      Parameters:
      keyInfoCanonicalizationMethod - - name of the canonicalization algorithm for dealing with KeyInfo.
    • isSignKeyInfo

      public boolean isSignKeyInfo()
      Returns value value specifying if "KeyInfo" element should be signed.
      Returns:
      TRUE if "KeyInfo" element must be signed, FALSE otherwise.
    • setSignKeyInfo

      public void setSignKeyInfo(boolean signKeyInfo)
      Set the parameter SignKeyInfo defining if the "KeyInfo" element must be signed and its reference must be included to "SignedInfo" element. The value is FALSE by default.
      Parameters:
      signKeyInfo - - if KeyInfo element should be signed
    • getReferences

      public List<DSSReference> getReferences()
      Returns a list of references to be incorporated to the signature
      Returns:
      a list of DSSReferences
    • setReferences

      public void setReferences(List<DSSReference> references)
      Sets a list of references to be incorporated into the signature NOTE: This method overwrites a default behavior on ds:Reference's creation. It should be used only by experienced users.
      Parameters:
      references - a list of DSSReferences
    • getXPathLocationString

      public String getXPathLocationString()
      Gets the xPath signature location string (ENVELOPED only)
      Returns:
      String xPath
    • setXPathLocationString

      public void setXPathLocationString(String xPathLocationString)
      Defines the position where the signature will be added (XAdES Enveloped)
      Parameters:
      xPathLocationString - the xpath position of the signature
    • getXPathElementPlacement

      public XAdESSignatureParameters.XPathElementPlacement getXPathElementPlacement()
      Returns the XPath element placement for Enveloped signature creation
      Returns:
      XAdESSignatureParameters.XPathElementPlacement
    • setXPathElementPlacement

      public void setXPathElementPlacement(XAdESSignatureParameters.XPathElementPlacement xPathElementPlacement)
      Defines the relation to the element referenced by the XPath where the signature will be added (XAdES Enveloped)
      Parameters:
      xPathElementPlacement - the placement of the signature
    • getRootDocument

      public Document getRootDocument()
      Returns the root document for INTERNALLY_DETACHED signature creation
      Returns:
      Document
    • setRootDocument

      public void setRootDocument(Document rootDocument)
      Sets the root document for INTERNALLY_DETACHED signature creation
      Parameters:
      rootDocument - Document
    • getContext

      public XAdESProfileParameters getContext()
      Gets the signature creation context (internal variable)
      Overrides:
      getContext in class eu.europa.esig.dss.AbstractSignatureParameters<XAdESTimestampParameters>
      Returns:
      XAdESProfileParameters
    • isEn319132

      public boolean isEn319132()
      Gets if the signature shall be created according to ETSI EN 319 132
      Returns:
      TRUE if the signature shall be created according to ETSI EN 319 132, otherwise according to the old standard
    • setEn319132

      public void setEn319132(boolean en319132)
      Sets if the signature shall be created according to ETSI EN 319 132 Default: true
      Parameters:
      en319132 - if the signature shall be created according to ETSI EN 319 132
    • isEmbedXML

      public boolean isEmbedXML()
      Gets if the signed content shall be incorporated as XML (used for ENVELOPING)
      Returns:
      TRUE if the signed content shall be incorporated as XML, FALSE otherwise (base64 encoded binaries)
    • setEmbedXML

      public void setEmbedXML(boolean embedXML)
      Sets if the signed content shall be incorporated as XML (used for ENVELOPING) If false, incorporates the document content in its base64 encoded representation Default: false (base64 encoded binaries)
      Parameters:
      embedXML - if the signed content shall be incorporated as XML
    • isManifestSignature

      public boolean isManifestSignature()
      Gets if the signature signs a manifest
      Returns:
      TRUE if the signature signs a manifest, FALSE otherwise
    • setManifestSignature

      public void setManifestSignature(boolean manifestSignature)
      Sets if the signature signs a manifest
      Parameters:
      manifestSignature - if the signature signs a manifest
    • isAddX509SubjectName

      public boolean isAddX509SubjectName()
      Gets if the <ds:X509Data> element shall be added
      Returns:
      TRUE if the X509Data element shall be added, FALSE otherwise
    • setAddX509SubjectName

      public void setAddX509SubjectName(boolean addX509SubjectName)
      Sets if the <ds:X509Data> element shall be added Default: false
      Parameters:
      addX509SubjectName - if the X509Data element shall be added
    • getSignedAdESObject

      public byte[] getSignedAdESObject()
      Gets a custom XAdES Object content
      Returns:
      XAdES Object binaries
    • setSignedAdESObject

      public void setSignedAdESObject(byte[] signedAdESObject)
      Sets a custom XAdES Object content
      Parameters:
      signedAdESObject - XAdES Object content to incorporate into the signature
    • isPrettyPrint

      public boolean isPrettyPrint()
      Gets if the signature shall be pretty-printed
      Returns:
      TRUE if pretty-print the signature, FALSE otherwise
    • setPrettyPrint

      public void setPrettyPrint(boolean prettyPrint)
      Sets if the signature shall be pretty-printed Default: false
      Parameters:
      prettyPrint - TRUE if to pretty-print the signature, FALSE otherwise
    • getXmldsigNamespace

      public eu.europa.esig.dss.xml.common.definition.DSSNamespace getXmldsigNamespace()
      This method returns the current used XMLDSig namespace Never returns null
      Returns:
      DSSNamespace
    • setXmldsigNamespace

      public void setXmldsigNamespace(eu.europa.esig.dss.xml.common.definition.DSSNamespace xmldsigNamespace)
      Sets the XMLDSIG namespace Default: ds:http://www.w3.org/2000/09/xmldsig#
      Parameters:
      xmldsigNamespace - DSSNamespace
    • getXadesNamespace

      public eu.europa.esig.dss.xml.common.definition.DSSNamespace getXadesNamespace()
      This method returns the current used XAdES namespace Never returns null
      Returns:
      DSSNamespace
    • setXadesNamespace

      public void setXadesNamespace(eu.europa.esig.dss.xml.common.definition.DSSNamespace xadesNamespace)
      Sets the XAdES namespace Default: xades:http://uri.etsi.org/01903/v1.3.2#
      Parameters:
      xadesNamespace - DSSNamespace
    • getXades141Namespace

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

      public void setXades141Namespace(eu.europa.esig.dss.xml.common.definition.DSSNamespace xades141Namespace)
      Sets the XAdES 1.4.1 namespace Default: xades141:http://uri.etsi.org/01903/v1.4.1#
      Parameters:
      xades141Namespace - DSSNamespace
    • getObjects

      public List<DSSObject> getObjects()
      Gets the list of custom ds:Object elements
      Returns:
      a list of DSSObjects
    • setObjects

      public void setObjects(List<DSSObject> objects)
      Sets the list of custom ds:Object elements to be incorporated within the ds:Signature
      Parameters:
      objects - a list of DSSObject to be included
    • getTokenReferencesDigestAlgorithm

      public eu.europa.esig.dss.enumerations.DigestAlgorithm getTokenReferencesDigestAlgorithm()
      Gets a DigestAlgorithm to create CompleteCertificateRefs/CompleteRevocationRefs with
      Returns:
      DigestAlgorithm
    • setTokenReferencesDigestAlgorithm

      public void setTokenReferencesDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm tokenReferencesDigestAlgorithm)
      Sets a DigestAlgorithm to create CompleteCertificateRefs/CompleteRevocationRefs for -C level Default : SHA256
      Parameters:
      tokenReferencesDigestAlgorithm - DigestAlgorithm
    • getDataObjectFormatList

      public List<DSSDataObjectFormat> getDataObjectFormatList()
      Gets a list of custom xades:DataObjectFormat elements
      Returns:
      list of DSSDataObjectFormats
    • setDataObjectFormatList

      public void setDataObjectFormatList(List<DSSDataObjectFormat> dataObjectFormatList)
      Sets a list of custom xades:DataObjectFormat elements to be incorporated within xades:SignedDataObjectProperties element of the signature. NOTE: this method overwrites default behavior on xades:DataObjectFormat creation. It should be used only by experienced users.
      Parameters:
      dataObjectFormatList - list of DSSDataObjectFormats
    • getContentTimestampParameters

      public XAdESTimestampParameters getContentTimestampParameters()
      Overrides:
      getContentTimestampParameters in class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters<XAdESTimestampParameters>
    • getSignatureTimestampParameters

      public XAdESTimestampParameters getSignatureTimestampParameters()
      Overrides:
      getSignatureTimestampParameters in class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters<XAdESTimestampParameters>
    • getArchiveTimestampParameters

      public XAdESTimestampParameters getArchiveTimestampParameters()
      Overrides:
      getArchiveTimestampParameters in class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters<XAdESTimestampParameters>
    • reinit

      public void reinit()
      Overrides:
      reinit in class eu.europa.esig.dss.AbstractSignatureParameters<XAdESTimestampParameters>