FirmaSAT  10.50.0
Static Public Member Functions | List of all members
firmasat::Tfd Class Reference

Methods for Timbre Fiscal Digital (TFD). More...

Static Public Member Functions

static int AddSignedTfd (const std::string &outFile, const std::string &inputFile, const std::string &keyFile, const std::string &password, const std::string &certFile)
 Add a signed Timbre Fiscal Digital (TFD) element to a CFDI document. More...
 
static std::string ExtractDigestFromSignature (const std::string &xmlFile, const std::string &certFile)
 Extract message digest from the selloSAT node in Timbre Fiscal Digital of CFDI document. More...
 
static std::string MakeDigestFromXml (const std::string &xmlFile)
 Form message digest of cadena original del Timbre Fiscal Digital del SAT (TFD piped string) from CFDI XML file. More...
 
static std::string MakePipeStringFromXml (const std::string &xmlFile)
 Create the cadena original del Timbre Fiscal Digital del SAT (TFD piped string) from CFDI XML file. More...
 
static std::string MakeSignatureFromXml (const std::string &xmlFile, const std::string &keyFile, const std::string &password)
 Extract message digest from the selloSAT node in Timbre Fiscal Digital of CFDI document. More...
 
static int VerifySignature (const std::string &xmlFile, const std::string &certFile)
 Verify the selloSAT signature in CFDI XML document. More...
 

Detailed Description

Methods for Timbre Fiscal Digital (TFD).

Member Function Documentation

◆ AddSignedTfd()

static int firmasat::Tfd::AddSignedTfd ( const std::string &  outFile,
const std::string &  inputFile,
const std::string &  keyFile,
const std::string &  password,
const std::string &  certFile 
)
static

Add a signed Timbre Fiscal Digital (TFD) element to a CFDI document.

Parameters
outFileName of new file to be created.
inputFileName of existing CFDI file
keyFileName of private key file.
passwordPassword for private key file.
certFileName of PAC's X.509 certificate that matches the keyFile (required)
Returns
0 if successful or nonzero error code if failed.
Remarks
The inputFile must be a version 3.2/3.3 CFDi document already signed with a sello/Sello field and no existing TFD element. The TFD will be timestamped using the system clock and a fresh UUID will be generated. No other XML processing is carried out except inserting the TFD element.
Note
The SelloSAT value will be different each time.

◆ ExtractDigestFromSignature()

static std::string firmasat::Tfd::ExtractDigestFromSignature ( const std::string &  xmlFile,
const std::string &  certFile 
)
static

Extract message digest from the selloSAT node in Timbre Fiscal Digital of CFDI document.

Parameters
xmlFileName of XML file to be processed (or a string containing XML data).
certFileX.509 certificate file of PAC who signed the TFD (required).
Returns
Message digest in hex format or empty string on error.

◆ MakeDigestFromXml()

static std::string firmasat::Tfd::MakeDigestFromXml ( const std::string &  xmlFile)
static

Form message digest of cadena original del Timbre Fiscal Digital del SAT (TFD piped string) from CFDI XML file.

Parameters
xmlFileName of XML file to be processed (or a string containing XML data).
Returns
Message digest in hex format or empty string on error.

◆ MakePipeStringFromXml()

static std::string firmasat::Tfd::MakePipeStringFromXml ( const std::string &  xmlFile)
static

Create the cadena original del Timbre Fiscal Digital del SAT (TFD piped string) from CFDI XML file.

Parameters
xmlFileName of XML file to be processed (or a string containing XML data).
Returns
Piped string (UTF-8 encoded).

◆ MakeSignatureFromXml()

static std::string firmasat::Tfd::MakeSignatureFromXml ( const std::string &  xmlFile,
const std::string &  keyFile,
const std::string &  password 
)
static

Extract message digest from the selloSAT node in Timbre Fiscal Digital of CFDI document.

Parameters
xmlFileName of XML file to be processed (or a string containing XML data).
keyFileName of private key file or string with PEM representation.
passwordPassword for private key file.
Returns
Signature in base64 format or empty string on error.

◆ VerifySignature()

static int firmasat::Tfd::VerifySignature ( const std::string &  xmlFile,
const std::string &  certFile 
)
static

Verify the selloSAT signature in CFDI XML document.

Parameters
xmlFileName of XML file to be processed (or a string containing XML data).
certFileX.509 certificate file of PAC who signed the TFD (required).
Returns
Zero if signature is verified or a nonzero error code if failed.
Copyright © 2006-22 D.I. Management Services Pty Limited ABN 78 083 210 584 Australia. All rights reserved. <www.di-mgt.com.au> <www.cryptosys.net>. Generated on Sat Mar 12 2022 21:02:20 by Doxygen 1.9.1.