Class XAdESSignatureFacet

java.lang.Object
org.apache.poi.poifs.crypt.dsig.facets.XAdESSignatureFacet
All Implemented Interfaces:
SignatureFacet

public class XAdESSignatureFacet extends Object implements 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.
See Also:
  • Constructor Details

    • XAdESSignatureFacet

      public XAdESSignatureFacet()
  • Method Details

    • preSign

      public void preSign(SignatureInfo signatureInfo, Document document, List<Reference> references, List<XMLObject> objects) throws XMLSignatureException
      Description copied from interface: 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.
      Specified by:
      preSign in interface SignatureFacet
      Parameters:
      signatureInfo - the signature info object holding the OPCPackage and other document related data
      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:
      XMLSignatureException
    • createSignedProperties

      protected org.etsi.uri.x01903.v13.SignedPropertiesType createSignedProperties(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.QualifyingPropertiesType qualifyingProperties)
      Create the signedProperties. Subclasses can easily extend the signed properties.
    • addSigningTime

      protected void addSigningTime(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.SignedSignaturePropertiesType signedSignatureProperties)
    • addCertificate

      protected void addCertificate(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.SignedSignaturePropertiesType signedSignatureProperties)
    • addXadesRole

      protected void addXadesRole(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.SignedSignaturePropertiesType signedSignatureProperties)
    • addPolicy

      protected void addPolicy(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.SignedSignaturePropertiesType signedSignatureProperties)
    • addMimeTypes

      protected void addMimeTypes(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.SignedPropertiesType signedProperties)
    • addXadesObject

      protected XMLObject addXadesObject(SignatureInfo signatureInfo, Document document, org.etsi.uri.x01903.v13.QualifyingPropertiesType qualifyingProperties)
    • addCommitmentType

      protected void addCommitmentType(SignatureInfo signatureInfo, org.etsi.uri.x01903.v13.SignedPropertiesType signedProperties)
    • addXadesReference

      protected Reference addXadesReference(SignatureInfo signatureInfo) throws XMLSignatureException
      Throws:
      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, X509Certificate certificate)
      Gives back the JAXB CertID data structure.
    • addMimeType

      public void addMimeType(String dsReferenceUri, 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 - the reference uri
      mimetype - the mimetype
    • insertXChild

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