Sample code for 30+ languages & platforms
Java

Create XAdES-EPES Factura Electrónica Signature

See more XAdES Examples

Demonstrates how to create an XAdES-EPES signature. The sample data is for the Costa Rica Factura Electrónica (http://www.hacienda.go.cr/contenido/14350-factura-electronica)

Note: This example requires Chilkat v9.5.0.75 or greater.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.Cert;
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.StringBuilder;
import com.chilkatsoft.chilkat2.Xml;
import com.chilkatsoft.chilkat2.XmlDSigGen;

public class ChilkatExample {

    public static void main(String[] args) {
        // This example requires the Chilkat API to have been previously unlocked.
        // See Global Unlock Sample for sample code.

        // This example will add an XAdES-EPES signature to the file
        // at FacturaElectronica_cr.xml
        //
        // The XML to be signed looks like this:

        //     <?xml version="1.0" encoding="UTF-8"?>
        //     <FacturaElectronica xmlns="https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/facturaElectronica"
        //                xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        //        <Clave>70609022800030259092400100001010000000005100001701</Clave>
        //        <NumeroConsecutivo>00100001010000000007</NumeroConsecutivo>
        //        <FechaEmision>2018-02-08T22:05:20.3925782-06:00</FechaEmision>
        //        <Emisor>
        //        ...
        //        </Emisor>
        //        ...
        //        <Normativa>
        //           <NumeroResolucion>DGT-R-48-2016</NumeroResolucion>
        //           <FechaResolucion>20-02-2017 13:22:22</FechaResolucion>
        //        </Normativa>
        //     </FacturaElectronica>

        // First load a certificate w/ private key from a .pfx.
        // (There are many different ways to provide the certificate + private key for signing.
        // loading a .pfx is just one particular way of doing it..)

        Cert cert = new Cert();
        try {
            cert.loadPfxFile("qa_data/pfx/cert_test123.pfx", "test123");
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        // Load XML to be signed.
        StringBuilder sbXml = new StringBuilder();
        try {
            sbXml.loadFile("qa_data/xades/factura_cr/FacturaElectronica.xml", "utf-8");
        } catch (ChilkatException e) {
            System.out.println("Failed to load file.");
            return;
        }

        XmlDSigGen gen = new XmlDSigGen();

        // Indicate where the signature is to be placed.
        gen.setSigLocation("FacturaElectronica");
        // The SigId can be any random unique string in any format (in other words, there is no expected format).
        // For example, "Hello_23946359203502" or "A3982BF7130C".  It is arbitrary.
        // However, other parts of the XML will reference the ID you use here.  (Search for the same string below and you'll see...)
        gen.setSigId("Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0");
        gen.setSigNamespacePrefix("ds");
        gen.setSignedInfoCanonAlg("C14N");
        gen.setSignedInfoDigestMethod("sha256");

        // --------------------------------------------------------------------
        // We want to build the QualifyingProperties XML, as shown below:
        // You can generate the code that creates this XML using the online tool
        // at XML Code Generator

        // I've place a copy of the QualifyingProperties XML at
        // QualifyingProperties_cr.xml

        //          <xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Id="QualifyingProperties-aa262416-8607-4f02-8897-0a6440a1ae03" Target="#Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //             <xades:SignedProperties Id="SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //                <xades:SignedSignatureProperties>
        //                   <xades:SigningTime>TO BE GENERATED BY CHILKAT</xades:SigningTime>
        //                   <xades:SigningCertificate>
        //                      <xades:Cert>
        //                         <xades:CertDigest>
        //                            <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //                            <ds:DigestValue>TO BE GENERATED BY CHILKAT</ds:DigestValue>
        //                         </xades:CertDigest>
        //                         <xades:IssuerSerial>
        //                            <ds:X509IssuerName>TO BE GENERATED BY CHILKAT</ds:X509IssuerName>
        //                            <ds:X509SerialNumber>TO BE GENERATED BY CHILKAT</ds:X509SerialNumber>
        //                         </xades:IssuerSerial>
        //                      </xades:Cert>
        //                   </xades:SigningCertificate>
        //                   <xades:SignaturePolicyIdentifier>
        //                      <xades:SignaturePolicyId>
        //                         <xades:SigPolicyId>
        //                            <xades:Identifier>https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/Resolucion%20Comprobantes%20Electronicos%20%20DGT-R-48-2016.pdf</xades:Identifier>
        //                            <xades:Description />
        //                         </xades:SigPolicyId>
        //                         <xades:SigPolicyHash>
        //                            <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //                            <ds:DigestValue>NmI5Njk1ZThkNzI0MmIzMGJmZDAyNDc4YjUwNzkzODM2NTBiOWUxNTBkMmI2YjgzYzZjM2I5NTZlNDQ4OWQzMQ==</ds:DigestValue>
        //                         </xades:SigPolicyHash>
        //                      </xades:SignaturePolicyId>
        //                   </xades:SignaturePolicyIdentifier>
        //                </xades:SignedSignatureProperties>
        //                <xades:SignedDataObjectProperties>
        //                   <xades:DataObjectFormat ObjectReference="#Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f">
        //                      <xades:MimeType>text/xml</xades:MimeType>
        //                      <xades:Encoding>UTF-8</xades:Encoding>
        //                   </xades:DataObjectFormat>
        //                </xades:SignedDataObjectProperties>
        //             </xades:SignedProperties>
        //          </xades:QualifyingProperties>
        //

        // This is the code generated by the online tool to create the above XML.
        // Note: Chilkat will automatically populate the strings indicated by "TO BE GENERATED BY CHILKAT" with actual/correct values
        // when the XML is signed.
        Xml xml = new Xml();
        xml.setTag("xades:QualifyingProperties");
        xml.addAttribute("xmlns:xades", "http://uri.etsi.org/01903/v1.3.2#");
        xml.addAttribute("Id", "QualifyingProperties-aa262416-8607-4f02-8897-0a6440a1ae03");
        xml.addAttribute("Target", "#Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0");
        xml.updateAttrAt("xades:SignedProperties", true, "Id", "SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0");
        xml.updateChildContent("xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningTime", "TO BE GENERATED BY CHILKAT");
        xml.updateAttrAt("xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningCertificateV2|xades:Cert|xades:CertDigest|ds:DigestMethod", true, "Algorithm", "http://www.w3.org/2001/04/xmlenc#sha256");
        xml.updateChildContent("xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningCertificateV2|xades:Cert|xades:CertDigest|ds:DigestValue", "TO BE GENERATED BY CHILKAT");
        xml.updateChildContent("xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningCertificateV2|xades:Cert|xades:IssuerSerialV2", "TO BE GENERATED BY CHILKAT");
        xml.updateChildContent("xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyId|xades:Identifier", "https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/Resolucion%20Comprobantes%20Electronicos%20%20DGT-R-48-2016.pdf");
        xml.updateChildContent("xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyId|xades:Description", "");
        xml.updateAttrAt("xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyHash|ds:DigestMethod", true, "Algorithm", "http://www.w3.org/2001/04/xmlenc#sha256");
        xml.updateChildContent("xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyHash|ds:DigestValue", "NmI5Njk1ZThkNzI0MmIzMGJmZDAyNDc4YjUwNzkzODM2NTBiOWUxNTBkMmI2YjgzYzZjM2I5NTZlNDQ4OWQzMQ==");
        xml.updateAttrAt("xades:SignedProperties|xades:SignedDataObjectProperties|xades:DataObjectFormat", true, "ObjectReference", "#Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f");
        xml.updateChildContent("xades:SignedProperties|xades:SignedDataObjectProperties|xades:DataObjectFormat|xades:MimeType", "text/xml");
        xml.updateChildContent("xades:SignedProperties|xades:SignedDataObjectProperties|xades:DataObjectFormat|xades:Encoding", "UTF-8");

        // --------------------------------------------------------------------
        // Add the QualifyingProperties as an Object in the Signature that is to be produced.

        gen.addObject("XadesObjectId-674a431e-692c-4e0a-9d82-6275c85c5876", xml.getXml(), "", "");

        // Add a Reference to the SignedProperties.
        String signedPropsId = "SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0";
        gen.addObjectRef(signedPropsId, "sha256", "EXCL_C14N", "", "http://uri.etsi.org/01903#SignedProperties");

        // When the Signature is generated, the Reference to the SignedProperties will look like this:

        //          <ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //             <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //             <ds:DigestValue>GLOA1AWNZhJM9NlK515TJmCE+/EKHlrIQJkkyTPPL4E=</ds:DigestValue>
        //          </ds:Reference>

        // --------------------------------------------------------------------
        // Add a reference to the KeyInfo, which does not yet exist because it will be
        // generated as part of the Signature.  However, we can specify the KeyInfo Id,
        // and then specify that during signature generation, a reference to the KeyInfo (using the Id)
        // should be added.

        // We'll want a KeyInfo that will look like this:

        //          <ds:Reference Id="ReferenceKeyInfo" URI="#KeyInfoId-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //             <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //             <ds:DigestValue>hbYK/DyNGpK4HtUQV8xsljxbrTJY4AS0SYOa1oW/FQw=</ds:DigestValue>
        //          </ds:Reference>

        String keyInfoId = "KeyInfoId-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0";
        gen.setKeyInfoId(keyInfoId);
        gen.addSameDocRef(keyInfoId, "sha256", "EXCL_C14N", "", "");
        gen.setRefIdAttr(keyInfoId, "ReferenceKeyInfo");

        // --------------------------------------------------------------------
        // Add our 3rd and final Reference, which is to the root element of the XML document being signed.

        gen.addSameDocRef("", "sha256", "EXCL_C14N", "", "");
        gen.setRefIdAttr("", "Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f");

        // The 3rd Reference will look like this:

        //          <ds:Reference Id="Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f" URI="">
        //             <ds:Transforms>
        //                <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
        //             </ds:Transforms>
        //             <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //             <ds:DigestValue>BvbWtgU5sBzQpS4xHOocHHmj97o/M895BsYb0ce+3LA=</ds:DigestValue>
        //          </ds:Reference>

        // ----------------------------------------------------------------
        // Provide the KeyInfo information.
        gen.setKeyInfoType("X509Data");
        gen.setX509Type("Certificate");
        try {
            gen.setX509Cert(cert, true);

            // --------------------------------------------------------------------
            // Create the XAdES-EPES signed XML.
            gen.setBehaviors("IndentedSignature");

            gen.createXmlDSigSb(sbXml);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        // Examine the signed XML
        System.out.println(sbXml.getAsString());

        // The following XAdES-EPES signed XML is produced:

        // <?xml version="1.0" encoding="UTF-8"?>
        // <FacturaElectronica xmlns="https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/facturaElectronica" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        //    <Clave>70609022800030259092400100001010000000005100001701</Clave>
        //    <NumeroConsecutivo>00100001010000000007</NumeroConsecutivo>
        //    <FechaEmision>2018-02-08T22:05:20.3925782-06:00</FechaEmision>
        //    <Emisor>
        //       <Nombre>Xavier Zarpio Yonge</Nombre>
        //       <Identificacion>
        //          <Tipo>01</Tipo>
        //          <Numero>302590926</Numero>
        //       </Identificacion>
        //       <NombreComercial />
        //       <Ubicacion>
        //          <Provincia>3</Provincia>
        //          <Canton>01</Canton>
        //          <Distrito>01</Distrito>
        //          <Barrio>01</Barrio>
        //          <OtrasSenas>555 al sur de la plaza los Angeles.</OtrasSenas>
        //       </Ubicacion>
        //       <Telefono>
        //          <CodigoPais>506</CodigoPais>
        //          <NumTelefono>99929567</NumTelefono>
        //       </Telefono>
        //       <Fax>
        //          <CodigoPais>506</CodigoPais>
        //          <NumTelefono>99929567</NumTelefono>
        //       </Fax>
        //       <CorreoElectronico>xavieryarpio@gmail.com</CorreoElectronico>
        //    </Emisor>
        //    <Receptor>
        //       <Nombre>Andy Malamar Catal�n</Nombre>
        //       <Identificacion>
        //          <Tipo>01</Tipo>
        //          <Numero>305580724</Numero>
        //       </Identificacion>
        //       <NombreComercial />
        //       <Ubicacion>
        //          <Provincia>3</Provincia>
        //          <Canton>01</Canton>
        //          <Distrito>01</Distrito>
        //          <Barrio>01</Barrio>
        //          <OtrasSenas>Cartago, los �ngeles</OtrasSenas>
        //       </Ubicacion>
        //       <Telefono>
        //          <CodigoPais>506</CodigoPais>
        //          <NumTelefono>84431131</NumTelefono>
        //       </Telefono>
        //       <Fax>
        //          <CodigoPais>506</CodigoPais>
        //          <NumTelefono>00000000</NumTelefono>
        //       </Fax>
        //       <CorreoElectronico>andycatalan12@hotmail.es</CorreoElectronico>
        //    </Receptor>
        //    <CondicionVenta>01</CondicionVenta>
        //    <PlazoCredito>0</PlazoCredito>
        //    <MedioPago>01</MedioPago>
        //    <DetalleServicio>
        //       <LineaDetalle>
        //          <NumeroLinea>1</NumeroLinea>
        //          <Codigo>
        //             <Tipo>01</Tipo>
        //             <Codigo>11</Codigo>
        //          </Codigo>
        //          <Cantidad>1.000</Cantidad>
        //          <UnidadMedida>Unid</UnidadMedida>
        //          <UnidadMedidaComercial />
        //          <Detalle>servicios profesionales</Detalle>
        //          <PrecioUnitario>30000.00000</PrecioUnitario>
        //          <MontoTotal>30000.00000</MontoTotal>
        //          <NaturalezaDescuento />
        //          <SubTotal>30000.00000</SubTotal>
        //          <MontoTotalLinea>30000.00000</MontoTotalLinea>
        //       </LineaDetalle>
        //    </DetalleServicio>
        //    <ResumenFactura>
        //       <CodigoMoneda>CRC</CodigoMoneda>
        //       <TipoCambio>1.00000</TipoCambio>
        //       <TotalServGravados>0.00000</TotalServGravados>
        //       <TotalServExentos>30000.00000</TotalServExentos>
        //       <TotalMercanciasGravadas>0.00000</TotalMercanciasGravadas>
        //       <TotalMercanciasExentas>0.00000</TotalMercanciasExentas>
        //       <TotalGravado>0.00000</TotalGravado>
        //       <TotalExento>30000.00000</TotalExento>
        //       <TotalVenta>30000.00000</TotalVenta>
        //       <TotalDescuentos>0.00000</TotalDescuentos>
        //       <TotalVentaNeta>30000.00000</TotalVentaNeta>
        //       <TotalImpuesto>0.00000</TotalImpuesto>
        //       <TotalComprobante>30000.00000</TotalComprobante>
        //    </ResumenFactura>
        //    <Normativa>
        //       <NumeroResolucion>DGT-R-48-2016</NumeroResolucion>
        //       <FechaResolucion>20-02-2017 13:22:22</FechaResolucion>
        //    </Normativa>
        // <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //   <ds:SignedInfo>
        //     <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
        //     <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
        //     <ds:Reference URI="#SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0" Type="http://uri.etsi.org/01903#SignedProperties">
        //       <ds:Transforms>
        //         <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        //       </ds:Transforms>
        //       <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        //       <ds:DigestValue>rk9bKozGf7gos5+gk77yd+6Or71uMtLKanLlJQ1CCJ4=</ds:DigestValue>
        //     </ds:Reference>
        //     <ds:Reference Id="Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f" URI="#KeyInfoId-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //       <ds:Transforms>
        //         <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        //       </ds:Transforms>
        //       <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        //       <ds:DigestValue>AHAsUXqwwBjpkiSelrzz7TJ7WjbM3IWOOF210YuYSEU=</ds:DigestValue>
        //     </ds:Reference>
        //     <ds:Reference Id="Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f" URI="">
        //       <ds:Transforms>
        //         <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
        //         <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        //       </ds:Transforms>
        //       <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        //       <ds:DigestValue>sU/yIR2Wh8xEaMQswFjQv65VCCm/1m/0Q+WZoORItw8=</ds:DigestValue>
        //     </ds:Reference>
        //   </ds:SignedInfo>
        //   <ds:SignatureValue>XL2OfTTE8mOwfF3jzZ9A+21xKImA6ClpahXwA7twJ4O6Zw4zLd9M4WIFOEd288Uch+Uvd3ixz+zn+F5ubkQS276DQ9WRIPwqaBapf3LqOjs3TcWq39UJbyq7Cnwd14HA5kefKZSzBLS8icoNpMm8/0vVJ7IyO9r10cxNZ5FMY8IAMRuQXRGNLvwRL+NVN4ZrH0ga6lkUciTfUi4ESJQBoRXyF6yLFbZry45ozXlrNFlrNIAwZf30L1+0MZKCp8MAlU8Sf+PfDWkMJ6ii1iaQkFFR6D4nrTi+9ZjDzNIwkfBvuAmouwEndhvcplBfHaiQFlbQmxqkQ9sjYeUH3X+ceg==</ds:SignatureValue>
        //   <ds:KeyInfo Id="KeyInfoId-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //     <ds:X509Data>
        //       <ds:X509Certificate>MIIFNTCCBB2gAwIBAgIQHozVnBl1lTsusAh26u6WZTANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxPTA7BgNVBAMTNENPTU9ETyBSU0EgQ2xpZW50IEF1dGhlbnRpY2F0aW9uIGFuZCBTZWN1cmUgRW1haWwgQ0EwHhcNMTcxMjE0MDAwMDAwWhcNMTgxMjE0MjM1OTU5WjAmMSQwIgYJKoZIhvcNAQkBFhVhc2Rhc2Rhc2Rhc2RkQGJ5b20uZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC96oQe50EDoiuJVITeKJzy6GzVq74cEa14eFypjMNbYVyedfCI6cn9pVClLqL7dlwxFGCRA62bbNE9woKLBT3SO1IvgoFDVIrbJm+84GEoqQReZe8HpZnF06d3DWwhUjjcuO1z2yliGdSymSee8/1OaztxEAEOWaZR+4MkfSNcAzzjGtKcKjVMSdiiO0JGAG/IXEwzlulfkF8zVdqDGkQTQesvT4WBys4BYwTDI64dsM7rcC9vwuK6gvpkUi9i1Wzu0W4v9T3iHAbl3rLihPcjQ95c4q7+NjwpRqQW1VXRenR/0iyLEFOek0D4JvOoscUwJ0LYd8f9SxFEWIzc4iAfAgMBAAGjggHrMIIB5zAfBgNVHSMEGDAWgBSCr2yM+MX+lmF86B89K3FIXsSLwDAdBgNVHQ4EFgQUrC0DOyBBAgOWgo2EfVZbppe3xfEwDgYDVR0PAQH/BAQDAgWgMAwGA1UdEwEB/wQCMAAwIAYDVR0lBBkwFwYIKwYBBQUHAwQGCysGAQQBsjEBAwUCMBEGCWCGSAGG+EIBAQQEAwIFIDBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEBATArMCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8ubmV0L0NQUzBaBgNVHR8EUzBRME+gTaBLhklodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9SU0FDbGllbnRBdXRoZW50aWNhdGlvbmFuZFNlY3VyZUVtYWlsQ0EuY3JsMIGLBggrBgEFBQcBAQR/MH0wVQYIKwYBBQUHMAKGSWh0dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NPTU9ET1JTQUNsaWVudEF1dGhlbnRpY2F0aW9uYW5kU2VjdXJlRW1haWxDQS5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTAgBgNVHREEGTAXgRVhc2Rhc2Rhc2Rhc2RkQGJ5b20uZGUwDQYJKoZIhvcNAQELBQADggEBAHEQTr0WFcwHVk0xozn26P3s6i3RWEcokNr8AdOtEvU0UYf1AfyVxUs04rS3Fs0lu2TD0840S3R687xF4HXhLYxSdD0QoZyUS2mgxxyVxCqhwptmLn7ZQjUKEuK6Kv6wZ3/XugsBoNrMYWlYX8g2jWVDBCJ+Z0eTQkaYkeSxzBSMQP3DxJS/bWh5LfwSyWYk4a3SVRJV4QVyBDXKt2uwjj1wWfxfGtiw6uAd2F3YIymZKsRVdrU6+h0gXMnmtpX8T+SDV6M72PP2/ZzF6gVVItyyrIScK1J8mcEaR5GGkLBk1s9qQM9esp3FRlACVeb1Qlytr4vgc5FlCqn0rMtjlF4=</ds:X509Certificate>
        //     </ds:X509Data>
        //   </ds:KeyInfo>
        //   <ds:Object Id="XadesObjectId-674a431e-692c-4e0a-9d82-6275c85c5876"><xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Id="QualifyingProperties-aa262416-8607-4f02-8897-0a6440a1ae03" Target="#Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //     <xades:SignedProperties Id="SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0">
        //         <xades:SignedSignatureProperties>
        //             <xades:SigningTime>2018-06-19T18:44:02-0500</xades:SigningTime>
        //             <xades:SigningCertificate>
        //                 <xades:Cert>
        //                     <xades:CertDigest>
        //                         <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //                         <ds:DigestValue>b8Dptsa8ynvygBZYOLl2u6Nxn1RfzJlR44OmxEw+9ak=</ds:DigestValue>
        //                     </xades:CertDigest>
        //                     <xades:IssuerSerial>
        //                         <ds:X509IssuerName>C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Client Authentication and Secure Email CA</ds:X509IssuerName>
        //                         <ds:X509SerialNumber>40608093954460556376902031137928287845</ds:X509SerialNumber>
        //                     </xades:IssuerSerial>
        //                 </xades:Cert>
        //             </xades:SigningCertificate>
        //             <xades:SignaturePolicyIdentifier>
        //                 <xades:SignaturePolicyId>
        //                     <xades:SigPolicyId>
        //                         <xades:Identifier>https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/Resolucion%20Comprobantes%20Electronicos%20%20DGT-R-48-2016.pdf</xades:Identifier>
        //                         <xades:Description />
        //                     </xades:SigPolicyId>
        //                     <xades:SigPolicyHash>
        //                         <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        //                         <ds:DigestValue>NmI5Njk1ZThkNzI0MmIzMGJmZDAyNDc4YjUwNzkzODM2NTBiOWUxNTBkMmI2YjgzYzZjM2I5NTZlNDQ4OWQzMQ==</ds:DigestValue>
        //                     </xades:SigPolicyHash>
        //                 </xades:SignaturePolicyId>
        //             </xades:SignaturePolicyIdentifier>
        //         </xades:SignedSignatureProperties>
        //         <xades:SignedDataObjectProperties>
        //             <xades:DataObjectFormat ObjectReference="#Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f">
        //                 <xades:MimeType>text/xml</xades:MimeType>
        //                 <xades:Encoding>UTF-8</xades:Encoding>
        //             </xades:DataObjectFormat>
        //         </xades:SignedDataObjectProperties>
        //     </xades:SignedProperties>
        // </xades:QualifyingProperties>
        // </ds:Object>
        // </ds:Signature></FacturaElectronica>
        //
    }
}