Class XAdESSignature

java.lang.Object
eu.europa.esig.dss.xades.validation.XAdESSignature
All Implemented Interfaces:
Serializable

public class XAdESSignature extends Object
Parse an XAdES signature structure. Note that for each signature to be validated a new instance of this object must be created.
See Also:
  • Field Details

    • detachedContents

      protected List<eu.europa.esig.dss.model.DSSDocument> detachedContents
    • manifestFile

      protected eu.europa.esig.dss.model.ManifestFile manifestFile
    • referenceValidations

      protected List<eu.europa.esig.dss.model.ReferenceValidation> referenceValidations
    • signatureCryptographicVerification

      protected eu.europa.esig.dss.model.signature.SignatureCryptographicVerification signatureCryptographicVerification
    • structureValidationMessages

      protected List<String> structureValidationMessages
    • signingCertificateSource

      protected eu.europa.esig.dss.spi.x509.CertificateSource signingCertificateSource
    • offlineCertificateSource

      protected eu.europa.esig.dss.spi.SignatureCertificateSource offlineCertificateSource
    • signatureCRLSource

      protected eu.europa.esig.dss.spi.x509.revocation.crl.OfflineCRLSource signatureCRLSource
    • signatureOCSPSource

      protected eu.europa.esig.dss.spi.x509.revocation.ocsp.OfflineOCSPSource signatureOCSPSource
    • signatureTimestampSource

      protected eu.europa.esig.dss.spi.x509.tsp.TimestampSource signatureTimestampSource
    • counterSignatures

      protected List<eu.europa.esig.dss.spi.signature.AdvancedSignature> counterSignatures
    • signaturePolicy

      protected eu.europa.esig.dss.model.signature.SignaturePolicy signaturePolicy
    • signatureIdentifier

      protected eu.europa.esig.dss.spi.signature.identifier.SignatureIdentifier signatureIdentifier
  • Constructor Details

    • XAdESSignature

      public XAdESSignature(Element signatureElement)
      This constructor is used when creating the signature. The default XPathQueryHolder is set.
      Parameters:
      signatureElement - the signature DOM element
    • XAdESSignature

      public XAdESSignature(Element signatureElement, List<XAdESPath> xadesPathHolders)
      The default constructor for XAdESSignature.
      Parameters:
      signatureElement - the signature DOM element
      xadesPathHolders - List of XAdESPaths to use when handling signature
  • Method Details

    • setDisableXSWProtection

      public void setDisableXSWProtection(boolean disableXSWProtection)
      NOT RECOMMENDED : This parameter allows to disable protection against XML Signature wrapping attacks (XSW). It disables the research by XPath expression for defined Type attributes.
      Parameters:
      disableXSWProtection - true to disable the protection
    • recursiveNamespaceBrowser

      public void recursiveNamespaceBrowser(Element element)
      This method sets the namespace which will determinate the XAdESPaths to use. The content of the Transform element is ignored.
      Parameters:
      element - Element
    • getXAdESPathsHolders

      public List<XAdESPath> getXAdESPathsHolders()
      Returns a list of used XAdESPaths
      Returns:
      a list of XAdESPaths
    • getXAdESPaths

      public XAdESPath getXAdESPaths()
      Gets the current XAdESPaths
      Returns:
      XAdESPath
    • getXmldSigNamespace

      public eu.europa.esig.dss.xml.common.definition.DSSNamespace getXmldSigNamespace()
      Returns the XMLDSIG namespace
      Returns:
      DSSNamespace
    • getXadesNamespace

      public eu.europa.esig.dss.xml.common.definition.DSSNamespace getXadesNamespace()
      Returns the XAdES namespace
      Returns:
      DSSNamespace
    • getSignatureElement

      public Element getSignatureElement()
      Returns the w3c.dom encapsulated signature element.
      Returns:
      the signatureElement
    • getSignatureForm

      public eu.europa.esig.dss.enumerations.SignatureForm getSignatureForm()
    • getEncryptionAlgorithm

      public eu.europa.esig.dss.enumerations.EncryptionAlgorithm getEncryptionAlgorithm()
    • getDigestAlgorithm

      public eu.europa.esig.dss.enumerations.DigestAlgorithm getDigestAlgorithm()
    • getSignatureAlgorithm

      public eu.europa.esig.dss.enumerations.SignatureAlgorithm getSignatureAlgorithm()
    • getCertificateSource

      public eu.europa.esig.dss.spi.SignatureCertificateSource getCertificateSource()
    • getCRLSource

      public eu.europa.esig.dss.spi.x509.revocation.crl.OfflineCRLSource getCRLSource()
    • getOCSPSource

      public eu.europa.esig.dss.spi.x509.revocation.ocsp.OfflineOCSPSource getOCSPSource()
    • getTimestampSource

      public XAdESTimestampSource getTimestampSource()
    • getSigningTime

      public Date getSigningTime()
    • getSignaturePolicy

      public XAdESSignaturePolicy getSignaturePolicy()
    • buildSignaturePolicy

      protected XAdESSignaturePolicy buildSignaturePolicy()
    • getSignatureProductionPlace

      public eu.europa.esig.dss.model.signature.SignatureProductionPlace getSignatureProductionPlace()
    • getSignaturePolicyStore

      public eu.europa.esig.dss.model.SignaturePolicyStore getSignaturePolicyStore()
    • getSignedAssertions

      public List<eu.europa.esig.dss.model.signature.SignerRole> getSignedAssertions()
    • getClaimedSignerRoles

      public List<eu.europa.esig.dss.model.signature.SignerRole> getClaimedSignerRoles()
    • getCertifiedSignerRoles

      public List<eu.europa.esig.dss.model.signature.SignerRole> getCertifiedSignerRoles()
    • getContentType

      public String getContentType()
    • getMimeType

      public String getMimeType()
    • getSignatureValueBase64

      public String getSignatureValueBase64()
      Returns a base64 SignatureValue
      Returns:
      base64 String
    • getSignatureValue

      public byte[] getSignatureValue()
    • getSignatureValueId

      public String getSignatureValueId()
      Returns Id of the ds:SignatureValue element
      Returns:
      String Id
    • getObjects

      public NodeList getObjects()
      This method returns the list of ds:Object elements for the current signature element.
      Returns:
      NodeList
    • addExternalTimestamp

      public void addExternalTimestamp(eu.europa.esig.dss.spi.x509.tsp.TimestampToken timestamp)
    • getBaselineRequirementsChecker

      protected XAdESBaselineRequirementsChecker getBaselineRequirementsChecker()
    • createBaselineRequirementsChecker

      protected XAdESBaselineRequirementsChecker createBaselineRequirementsChecker(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
    • checkSignatureIntegrity

      public void checkSignatureIntegrity()
    • getReferenceValidations

      public List<eu.europa.esig.dss.model.ReferenceValidation> getReferenceValidations()
    • getSignatureDigestReference

      public eu.europa.esig.dss.model.signature.SignatureDigestReference getSignatureDigestReference(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      TS 119 442 - V1.1.1 - Electronic Signatures and Infrastructures (ESI), ch. 5.1.4.2.1.3 XML component:

      In case of XAdES signatures, the input of the digest value computation shall be the result of applying the canonicalization algorithm identified within the CanonicalizationMethod child element's value to the corresponding ds:Signature element and its contents. The canonicalization shall be computed keeping this ds:Signature element as a descendant of the XML root element, without detaching it.

    • getDataToBeSignedRepresentation

      public eu.europa.esig.dss.model.Digest getDataToBeSignedRepresentation()
    • getSignedInfo

      public Element getSignedInfo()
      Returns the ds:SignedInfo element
      Returns:
      Element ds:SignedInfo
    • getObjectById

      public Node getObjectById(String id)
      Gets ds:Object by its Id
      Parameters:
      id - String object Id
      Returns:
      Node
    • getManifestById

      public Element getManifestById(String id)
      Gets ds:Manifest by its Id
      Parameters:
      id - String manifest Id
      Returns:
      Element Manifest
    • getCounterSignatures

      public List<eu.europa.esig.dss.spi.signature.AdvancedSignature> getCounterSignatures()
      This method retrieves the potential countersignatures embedded in the XAdES signature document. From ETSI TS 101 903 v1.4.2:

      7.2.4.1 Countersignature identifier in Type attribute of ds:Reference

      A XAdES signature containing a ds:Reference element whose Type attribute has value "http://uri.etsi.org/01903#CountersignedSignature" will indicate that is is, in fact, a countersignature of the signature referenced by this element.

      7.2.4.2 Enveloped countersignatures: the CounterSignature element

      The CounterSignature is an unsigned property that qualifies the signature. A XAdES signature MAY have more than one CounterSignature properties. As indicated by its name, it contains one countersignature of the qualified signature.

      Returns:
      a list containing the countersignatures embedded in the XAdES signature document
    • getSignatureIdentifierBuilder

      protected eu.europa.esig.dss.spi.signature.identifier.SignatureIdentifierBuilder getSignatureIdentifierBuilder()
    • getDAIdentifier

      public String getDAIdentifier()
    • getUnsignedSignatureProperties

      public List<String> getUnsignedSignatureProperties()
      Retrieves the name of each node found under the UnsignedSignatureProperties element
      Returns:
      an ArrayList containing the retrieved node names
    • getSignedSignatureProperties

      public List<String> getSignedSignatureProperties()
      Retrieves the name of each node found under the SignedSignatureProperties element
      Returns:
      an ArrayList containing the retrieved node names
    • getSignedProperties

      public List<String> getSignedProperties()
      Retrieves the name of each node found under the SignedProperties element
      Returns:
      an ArrayList containing the retrieved node names
    • getUnsignedProperties

      public List<String> getUnsignedProperties()
      Retrieves the name of each node found under the UnsignedProperties element
      Returns:
      an ArrayList containing the retrieved node names
    • getSignedDataObjectProperties

      public List<String> getSignedDataObjectProperties()
      Retrieves the name of each node found under the SignedDataObjectProperties element
      Returns:
      an ArrayList containing the retrieved node names
    • getDataFoundUpToLevel

      public eu.europa.esig.dss.enumerations.SignatureLevel getDataFoundUpToLevel()
    • validateStructure

      public List<String> validateStructure()
    • findSignatureScopes

      protected List<eu.europa.esig.dss.model.scope.SignatureScope> findSignatureScopes()
    • getCommitmentTypeIndications

      public List<eu.europa.esig.dss.model.signature.CommitmentTypeIndication> getCommitmentTypeIndications()
    • getReferences

      public List<org.apache.xml.security.signature.Reference> getReferences()
      Gets a list of found references
      Returns:
      a list of References
    • getSignatureObjects

      public List<Element> getSignatureObjects()
      Gets a list of found signature ds:Object elements
      Returns:
      a list of Elements
    • registerXAdESPaths

      public void registerXAdESPaths(XAdESPath xadesPaths)
      This method allows to register a new XAdESPaths.
      Parameters:
      xadesPaths - XAdESPaths to register
    • setSigningCertificateSource

      public void setSigningCertificateSource(eu.europa.esig.dss.spi.x509.CertificateSource arg0)
    • getFilename

      public String getFilename()
    • setFilename

      public void setFilename(String arg0)
    • getDetachedContents

      public List<eu.europa.esig.dss.model.DSSDocument> getDetachedContents()
    • setDetachedContents

      public void setDetachedContents(List<eu.europa.esig.dss.model.DSSDocument> arg0)
    • getContainerContents

      public List<eu.europa.esig.dss.model.DSSDocument> getContainerContents()
    • setContainerContents

      public void setContainerContents(List<eu.europa.esig.dss.model.DSSDocument> arg0)
    • getManifestFile

      public eu.europa.esig.dss.model.ManifestFile getManifestFile()
    • setManifestFile

      public void setManifestFile(eu.europa.esig.dss.model.ManifestFile arg0)
    • getDSSId

      public eu.europa.esig.dss.spi.signature.identifier.SignatureIdentifier getDSSId()
    • getId

      public String getId()
    • getCompleteCertificateSource

      public eu.europa.esig.dss.spi.x509.ListCertificateSource getCompleteCertificateSource()
    • getCompleteCRLSource

      public eu.europa.esig.dss.spi.x509.revocation.ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.crl.CRL> getCompleteCRLSource()
    • getCompleteOCSPSource

      public eu.europa.esig.dss.spi.x509.revocation.ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.ocsp.OCSP> getCompleteOCSPSource()
    • getCounterSignaturesCertificateSource

      protected eu.europa.esig.dss.spi.x509.ListCertificateSource getCounterSignaturesCertificateSource()
    • getCounterSignaturesCRLSource

      protected eu.europa.esig.dss.spi.x509.revocation.ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.crl.CRL> getCounterSignaturesCRLSource()
    • getCounterSignaturesOCSPSource

      protected eu.europa.esig.dss.spi.x509.revocation.ListRevocationSource<eu.europa.esig.dss.model.x509.revocation.ocsp.OCSP> getCounterSignaturesOCSPSource()
    • resetCertificateSource

      public void resetCertificateSource()
    • resetRevocationSources

      public void resetRevocationSources()
    • resetTimestampSource

      public void resetTimestampSource()
    • getCandidatesForSigningCertificate

      public eu.europa.esig.dss.spi.x509.CandidatesForSigningCertificate getCandidatesForSigningCertificate()
    • initBaselineRequirementsChecker

      public void initBaselineRequirementsChecker(eu.europa.esig.dss.spi.validation.CertificateVerifier arg0)
    • getCertificates

      public List<eu.europa.esig.dss.model.x509.CertificateToken> getCertificates()
    • setMasterSignature

      public void setMasterSignature(eu.europa.esig.dss.spi.signature.AdvancedSignature arg0)
    • getMasterSignature

      public eu.europa.esig.dss.spi.signature.AdvancedSignature getMasterSignature()
    • isCounterSignature

      public boolean isCounterSignature()
    • getSignatureCryptographicVerification

      public eu.europa.esig.dss.model.signature.SignatureCryptographicVerification getSignatureCryptographicVerification()
    • getSignerRoles

      public List<eu.europa.esig.dss.model.signature.SignerRole> getSignerRoles()
    • getSigningCertificateToken

      public eu.europa.esig.dss.model.x509.CertificateToken getSigningCertificateToken()
    • getStructureValidationResult

      public List<String> getStructureValidationResult()
    • getSignatureScopes

      public List<eu.europa.esig.dss.model.scope.SignatureScope> getSignatureScopes()
    • getContentTimestamps

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getContentTimestamps()
    • getSignatureTimestamps

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getSignatureTimestamps()
    • getTimestampsX1

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getTimestampsX1()
    • getTimestampsX2

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getTimestampsX2()
    • getArchiveTimestamps

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getArchiveTimestamps()
    • getDocumentTimestamps

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getDocumentTimestamps()
    • getDetachedTimestamps

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getDetachedTimestamps()
    • getAllTimestamps

      public List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> getAllTimestamps()
    • getEmbeddedEvidenceRecords

      public List<eu.europa.esig.dss.spi.x509.evidencerecord.EvidenceRecord> getEmbeddedEvidenceRecords()
    • addExternalEvidenceRecord

      public void addExternalEvidenceRecord(eu.europa.esig.dss.spi.x509.evidencerecord.EvidenceRecord arg0)
    • getDetachedEvidenceRecords

      public List<eu.europa.esig.dss.spi.x509.evidencerecord.EvidenceRecord> getDetachedEvidenceRecords()
    • getAllEvidenceRecords

      public List<eu.europa.esig.dss.spi.x509.evidencerecord.EvidenceRecord> getAllEvidenceRecords()
    • hasBProfile

      public boolean hasBProfile()
    • hasTProfile

      public boolean hasTProfile()
    • hasLTProfile

      public boolean hasLTProfile()
    • hasLTAProfile

      public boolean hasLTAProfile()
    • hasBESProfile

      public boolean hasBESProfile()
    • hasEPESProfile

      public boolean hasEPESProfile()
    • hasExtendedTProfile

      public boolean hasExtendedTProfile()
    • hasCProfile

      public boolean hasCProfile()
    • hasXProfile

      public boolean hasXProfile()
    • hasXLProfile

      public boolean hasXLProfile()
    • hasAProfile

      public boolean hasAProfile()
    • hasERSProfile

      public boolean hasERSProfile()
    • areAllSelfSignedCertificates

      public boolean areAllSelfSignedCertificates()
    • isDocHashOnlyValidation

      public boolean isDocHashOnlyValidation()
    • isHashOnlyValidation

      public boolean isHashOnlyValidation()
    • equals

      public boolean equals(Object arg0)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object