Class MakeXmlSignature


  • public class MakeXmlSignature
    extends java.lang.Object
    Class that signs your XML.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void signXades​(XmlSignatureAppearance sap, ExternalSignature externalSignature, java.security.cert.Certificate[] chain, boolean includeSignaturePolicy)
      Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
      static void signXadesBes​(XmlSignatureAppearance sap, ExternalSignature externalSignature, java.security.cert.Certificate[] chain)
      Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
      static void signXadesEpes​(XmlSignatureAppearance sap, ExternalSignature externalSignature, java.security.cert.Certificate[] chain)
      Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
      static void signXmlDSig​(XmlSignatureAppearance sap, ExternalSignature externalSignature, java.security.cert.Certificate[] chain)
      Signs the xml with XmlDSig using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
      static void signXmlDSig​(XmlSignatureAppearance sap, ExternalSignature externalSignature, java.security.PublicKey publicKey)
      Signs the xml with XmlDSig using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
      static void signXmlDSig​(XmlSignatureAppearance sap, ExternalSignature externalSignature, javax.xml.crypto.dsig.keyinfo.KeyInfo keyInfo)
      Signs the xml with XmlDSig using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MakeXmlSignature

        public MakeXmlSignature()
    • Method Detail

      • signXmlDSig

        public static void signXmlDSig​(XmlSignatureAppearance sap,
                                       ExternalSignature externalSignature,
                                       javax.xml.crypto.dsig.keyinfo.KeyInfo keyInfo)
                                throws java.security.GeneralSecurityException,
                                       java.io.IOException,
                                       DocumentException
        Signs the xml with XmlDSig using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
        Parameters:
        sap - the XmlSignatureAppearance
        externalSignature - the interface providing the actual signing
        keyInfo - KeyInfo for verification
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        DocumentException
      • signXmlDSig

        public static void signXmlDSig​(XmlSignatureAppearance sap,
                                       ExternalSignature externalSignature,
                                       java.security.cert.Certificate[] chain)
                                throws DocumentException,
                                       java.security.GeneralSecurityException,
                                       java.io.IOException
        Signs the xml with XmlDSig using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
        Parameters:
        sap - the XmlSignatureAppearance
        externalSignature - the interface providing the actual signing
        chain - the certificate chain
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        DocumentException
      • signXmlDSig

        public static void signXmlDSig​(XmlSignatureAppearance sap,
                                       ExternalSignature externalSignature,
                                       java.security.PublicKey publicKey)
                                throws java.security.GeneralSecurityException,
                                       DocumentException,
                                       java.io.IOException
        Signs the xml with XmlDSig using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
        Parameters:
        sap - the XmlSignatureAppearance
        externalSignature - the interface providing the actual signing
        publicKey - PublicKey for verification
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        DocumentException
      • signXades

        public static void signXades​(XmlSignatureAppearance sap,
                                     ExternalSignature externalSignature,
                                     java.security.cert.Certificate[] chain,
                                     boolean includeSignaturePolicy)
                              throws java.security.GeneralSecurityException,
                                     DocumentException,
                                     java.io.IOException
        Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
        Parameters:
        sap - the XmlSignatureAppearance
        externalSignature - the interface providing the actual signing
        chain - the certificate chain
        includeSignaturePolicy - if true SignaturePolicyIdentifier will be included (XAdES-EPES)
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        DocumentException
      • signXadesBes

        public static void signXadesBes​(XmlSignatureAppearance sap,
                                        ExternalSignature externalSignature,
                                        java.security.cert.Certificate[] chain)
                                 throws java.security.GeneralSecurityException,
                                        DocumentException,
                                        java.io.IOException
        Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
        Parameters:
        sap - the XmlSignatureAppearance
        externalSignature - the interface providing the actual signing
        chain - the certificate chain
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        DocumentException
      • signXadesEpes

        public static void signXadesEpes​(XmlSignatureAppearance sap,
                                         ExternalSignature externalSignature,
                                         java.security.cert.Certificate[] chain)
                                  throws java.security.GeneralSecurityException,
                                         DocumentException,
                                         java.io.IOException
        Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
        Parameters:
        sap - the XmlSignatureAppearance
        externalSignature - the interface providing the actual signing
        chain - the certificate chain
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        DocumentException