Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

C Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(C) Create XAdES-EPES Factura Electrónica Signature

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 C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Solaris C/C++

MinGW C/C++

#include <C_CkCert.h>
#include <C_CkStringBuilder.h>
#include <C_CkXmlDSigGen.h>
#include <C_CkXml.h>

void ChilkatSample(void)
    {
    HCkCert cert;
    BOOL success;
    HCkStringBuilder sbXml;
    HCkXmlDSigGen gen;
    HCkXml xml;
    const char *signedPropsId;
    const char *keyInfoId;

    // 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 = CkCert_Create();
    success = CkCert_LoadPfxFile(cert,"qa_data/pfx/cert_test123.pfx","test123");
    if (success != TRUE) {
        printf("%s\n",CkCert_lastErrorText(cert));
        CkCert_Dispose(cert);
        return;
    }

    // Load XML to be signed.
    sbXml = CkStringBuilder_Create();
    success = CkStringBuilder_LoadFile(sbXml,"qa_data/xades/factura_cr/FacturaElectronica.xml","utf-8");
    if (success != TRUE) {
        printf("Failed to load file.\n");
        CkCert_Dispose(cert);
        CkStringBuilder_Dispose(sbXml);
        return;
    }

    gen = CkXmlDSigGen_Create();

    // Indicate where the signature is to be placed.
    CkXmlDSigGen_putSigLocation(gen,"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...)
    CkXmlDSigGen_putSigId(gen,"Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0");
    CkXmlDSigGen_putSigNamespacePrefix(gen,"ds");
    CkXmlDSigGen_putSignedInfoCanonAlg(gen,"C14N");
    CkXmlDSigGen_putSignedInfoDigestMethod(gen,"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 = CkXml_Create();
    CkXml_putTag(xml,"xades:QualifyingProperties");
    CkXml_AddAttribute(xml,"xmlns:xades","http://uri.etsi.org/01903/v1.3.2#");
    CkXml_AddAttribute(xml,"Id","QualifyingProperties-aa262416-8607-4f02-8897-0a6440a1ae03");
    CkXml_AddAttribute(xml,"Target","#Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0");
    CkXml_UpdateAttrAt(xml,"xades:SignedProperties",TRUE,"Id","SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningTime","TO BE GENERATED BY CHILKAT");
    CkXml_UpdateAttrAt(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningCertificateV2|xades:Cert|xades:CertDigest|ds:DigestMethod",TRUE,"Algorithm","http://www.w3.org/2001/04/xmlenc#sha256");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningCertificateV2|xades:Cert|xades:CertDigest|ds:DigestValue","TO BE GENERATED BY CHILKAT");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SigningCertificateV2|xades:Cert|xades:IssuerSerialV2","TO BE GENERATED BY CHILKAT");
    CkXml_UpdateChildContent(xml,"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");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyId|xades:Description","");
    CkXml_UpdateAttrAt(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyHash|ds:DigestMethod",TRUE,"Algorithm","http://www.w3.org/2001/04/xmlenc#sha256");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedSignatureProperties|xades:SignaturePolicyIdentifier|xades:SignaturePolicyId|xades:SigPolicyHash|ds:DigestValue","NmI5Njk1ZThkNzI0MmIzMGJmZDAyNDc4YjUwNzkzODM2NTBiOWUxNTBkMmI2YjgzYzZjM2I5NTZlNDQ4OWQzMQ==");
    CkXml_UpdateAttrAt(xml,"xades:SignedProperties|xades:SignedDataObjectProperties|xades:DataObjectFormat",TRUE,"ObjectReference","#Reference-ab26afbd-e2dc-4cb0-886a-ce2a4a118c7f");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedDataObjectProperties|xades:DataObjectFormat|xades:MimeType","text/xml");
    CkXml_UpdateChildContent(xml,"xades:SignedProperties|xades:SignedDataObjectProperties|xades:DataObjectFormat|xades:Encoding","UTF-8");

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

    CkXmlDSigGen_AddObject(gen,"XadesObjectId-674a431e-692c-4e0a-9d82-6275c85c5876",CkXml_getXml(xml),"","");

    // Add a Reference to the SignedProperties.
    signedPropsId = "SignedProperties-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0";
    CkXmlDSigGen_AddObjectRef(gen,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>

    keyInfoId = "KeyInfoId-Signature-d1cbfe99-fd8e-4e0f-b0b7-fc5bfe2f1dd0";
    CkXmlDSigGen_putKeyInfoId(gen,keyInfoId);
    CkXmlDSigGen_AddSameDocRef(gen,keyInfoId,"sha256","EXCL_C14N","","");
    CkXmlDSigGen_SetRefIdAttr(gen,keyInfoId,"ReferenceKeyInfo");

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

    CkXmlDSigGen_AddSameDocRef(gen,"","sha256","EXCL_C14N","","");
    CkXmlDSigGen_SetRefIdAttr(gen,"","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.
    CkXmlDSigGen_putKeyInfoType(gen,"X509Data");
    CkXmlDSigGen_putX509Type(gen,"Certificate");
    success = CkXmlDSigGen_SetX509Cert(gen,cert,TRUE);
    if (success == FALSE) {
        printf("%s\n",CkXmlDSigGen_lastErrorText(gen));
        CkCert_Dispose(cert);
        CkStringBuilder_Dispose(sbXml);
        CkXmlDSigGen_Dispose(gen);
        CkXml_Dispose(xml);
        return;
    }

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

    success = CkXmlDSigGen_CreateXmlDSigSb(gen,sbXml);
    if (success == FALSE) {
        printf("%s\n",CkXmlDSigGen_lastErrorText(gen));
        CkCert_Dispose(cert);
        CkStringBuilder_Dispose(sbXml);
        CkXmlDSigGen_Dispose(gen);
        CkXml_Dispose(xml);
        return;
    }

    // Examine the signed XML
    printf("%s\n",CkStringBuilder_getAsString(sbXml));

    // 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>
    // 


    CkCert_Dispose(cert);
    CkStringBuilder_Dispose(sbXml);
    CkXmlDSigGen_Dispose(gen);
    CkXml_Dispose(xml);

    }

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.