org.apache.poi.poifs.crypt.dsig.facets

## Class XAdESSignatureFacet

- java.lang.Object
- - org.apache.poi.poifs.crypt.dsig.facets.SignatureFacet
  - - org.apache.poi.poifs.crypt.dsig.facets.XAdESSignatureFacet

- All Implemented Interfaces:
    SignatureConfig.SignatureConfigurable

      public class XAdESSignatureFacet
      extends SignatureFacet

  XAdES Signature Facet. Implements XAdES v1.4.1 which is compatible with XAdES v1.3.2. The implemented XAdES format is XAdES-BES/EPES. It's up to another part of the signature service to upgrade the XAdES-BES to a XAdES-X-L. This implementation has been tested against an implementation that participated multiple ETSI XAdES plugtests.
  Author:
    Frank Cornelis
  See Also:
    XAdES

- - ### Field Summary

    - ### Fields inherited from class org.apache.poi.poifs.crypt.dsig.facets.SignatureFacet

      `MS_DIGSIG_NS, OO_DIGSIG_NS, signatureConfig, XADES_132_NS, XADES_141_NS, XML_DIGSIG_NS, XML_NS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XAdESSignatureFacet()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMimeType(java.lang.String dsReferenceUri, java.lang.String mimetype)` Adds a mime-type for the given ds:Reference (referred via its @URI).
    `protected static void` | `insertXChild(org.apache.xmlbeans.XmlObject root, org.apache.xmlbeans.XmlObject child)`
    `void` | `preSign(org.w3c.dom.Document document, java.util.List<javax.xml.crypto.dsig.Reference> references, java.util.List<javax.xml.crypto.dsig.XMLObject> objects)` This method is being invoked by the XML signature service engine during pre-sign phase.
    `protected static void` | `setCertID(org.etsi.uri.x01903.v13.CertIDType certId, SignatureConfig signatureConfig, boolean issuerNameNoReverseOrder, java.security.cert.X509Certificate certificate)` Gives back the JAXB CertID data structure.
    `protected static void` | `setDigestAlgAndValue(org.etsi.uri.x01903.v13.DigestAlgAndValueType digestAlgAndValue, byte[] data, HashAlgorithm digestAlgo)` Gives back the JAXB DigestAlgAndValue data structure.

    - ### Methods inherited from class org.apache.poi.poifs.crypt.dsig.facets.SignatureFacet

      `getSignatureFactory, newReference, newReference, newTransform, newTransform, postSign, setSignatureConfig`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XAdESSignatureFacet

          public XAdESSignatureFacet()

  - ### Method Detail

    - #### preSign

          public void preSign(org.w3c.dom.Document document,
                              java.util.List<javax.xml.crypto.dsig.Reference> references,
                              java.util.List<javax.xml.crypto.dsig.XMLObject> objects)
                       throws javax.xml.crypto.dsig.XMLSignatureException

      Description copied from class: `SignatureFacet`
      This method is being invoked by the XML signature service engine during pre-sign phase. Via this method a signature facet implementation can add signature facets to an XML signature.
      Overrides:
        `preSign` in class `SignatureFacet`
      Parameters:
        `document` - the signature document to be used for imports
        `references` - list of reference definitions
        `objects` - objects to be signed/included in the signature document
      Throws:
        `javax.xml.crypto.dsig.XMLSignatureException`

    - #### setDigestAlgAndValue

          protected static void setDigestAlgAndValue(org.etsi.uri.x01903.v13.DigestAlgAndValueType digestAlgAndValue,
                                                     byte[] data,
                                                     HashAlgorithm digestAlgo)

      Gives back the JAXB DigestAlgAndValue data structure.
      Parameters:
        `digestAlgAndValue` - the parent for the new digest element
        `data` - the data to be digested
        `digestAlgo` - the digest algorithm

    - #### setCertID

          protected static void setCertID(org.etsi.uri.x01903.v13.CertIDType certId,
                                          SignatureConfig signatureConfig,
                                          boolean issuerNameNoReverseOrder,
                                          java.security.cert.X509Certificate certificate)

      Gives back the JAXB CertID data structure.

    - #### addMimeType

          public void addMimeType(java.lang.String dsReferenceUri,
                                  java.lang.String mimetype)

      Adds a mime-type for the given ds:Reference (referred via its @URI). This information is added via the xades:DataObjectFormat element.
      Parameters:
        `dsReferenceUri` -
        `mimetype` -

    - #### insertXChild

          protected static void insertXChild(org.apache.xmlbeans.XmlObject root,
                                             org.apache.xmlbeans.XmlObject child)

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.