Here are some example XML documents for Anexo 20 Versión 4.0 (CFDi v4.0) as specified by the Servicio de Administración Tributaria (SAT) in Mexico as published December 2021. The analysis and signing were carried out using v10.40.1 of FirmaSAT. For our summary of the latest information and links for the complementos, see Complementos and Complementos Concepto.
We hope you will find these useful in your own tests, but be aware that the values used for the attributes are nonsense ones picked at random just for testing purposes. Most examples just assign a random, but valid, value to every possible node in the XSD structure. The resulting documents are still valid XML (against the XSD) but will probably not comply with the guidelines in, say, GuíaAnexo20.pdf. This does not matter for our purposes of creating the cadena original and the Sello.
All the XML documents below have been validated against the XSD files published by SAT using independent XSD validation software, and each pipe-string (cadena original) provided here has been confirmed using the latest XSLT files published by SAT, again using independent XML stylesheet software.
See how to form the cadena original and compute its SHA-256 digest.
Document | Cadena original | SHA-256 digest of cadena original | Comments |
---|---|---|---|
cfdv40-ejemplo.xml | cfdv40-ejemplo-cadena.txt | c1492662dbd98ddbb7892d027c10808236e296eded13deec87179c2a8fdc742e |
All possible nodes filled with random, but valid, values. |
cfdv40-min.xml | cfdv40-min-cadena.txt | 51566373abf060f9fe79e2967ddc84bc4944c47f7e1346b3873aa62b1b2b15b0 |
Just the minimum required nodes. |
cfdv40-ejemplo-signed-tfd.xml | cfdv40-ejemplo-signed-tfd-cadena.txt | c1492662dbd98ddbb7892d027c10808236e296eded13deec87179c2a8fdc742e |
See Note 1 and Note 2. |
cfdv40-pagos20.xml | cfdv40-pagos20-cadena.txt | c8752b9b1996842376ccabfd593ec6951a2f5e17a0d9e491d2c0d8bb68d41bc3 |
Complemento Pagos20 .
|
cfdv40-pagos20-all.xml | cfdv40-pagos20-all-cadena.txt | 4c66def7b0cc4f1687d9ccade94407f39cf48d9dcf03d995e5bb5f14e7ac6dfb |
All possible nodes for complemento Pagos20 completed randomly |
cfdv40-pagos20-min.xml | cfdv40-pagos20-min-cadena.txt | 0a2f3efe7ffee424384d82de444a2e1ec73d0510f0db8e23e0753fbcc125f9ab |
Minimum nodes required for a complemento Pagos20 . |
cfdv40-cartaporte20.xml | cfdv40-cartaporte20-cadena.txt | ae1d47614602de202bb3500b22c54d56384b8fe3c4d92e801c2e68bbf427ba1a |
Complemento Carta Porte v2.0 (cartaporte20 ). |
cfdv40-cartaporte20-min.xml | cfdv40-cartaporte20-min-cadena.txt | 4f88985c89ace48fbb21a7a245b560f44731b30f3cbd70339c2dfdfe8232b4cb |
Minimum nodes required for a complemento cartaporte20 . |
Retenciones v2.0 | |||
retenciones20-ejemplo.xml | retenciones20-ejemplo-cadena.txt | db706ce8b9db69869b482426d7e013f75df79aa7ac16ba21062db3e01b6b1b16 |
All possible nodes of Retenciones v2.0 (retencionpago2 ) filled. |
retenciones20-min.xml | retenciones20-min-cadena.txt | a8d7469687caaa534ddcac64e1fa2512ac13b0de034f63112bf8b14dd755ba88 |
Minimum required nodes. |
retenciones20-min-comps.xml | retenciones20-min-comps-cadena.txt | dff8d312d0302de3e952bc5b3b9511f5b308cc414368277b89a254ad62c4d049 |
Minimum required nodes for all possible complementos. |
Other complementos | |||
cfdv40-aerolineas.xml | cfdv40-aerolineas-cadena.txt | bf0f06c65dba664bab89f93fc6af99b94dbf274c15dbd254a1e1745fcfe8792c |
Complemento aerolineas . |
cfdv40-cce11.xml | cfdv40-cce11-cadena.txt | 801518b226383d5ee1a106d6d73e8d8971ec96aa6306670b950b5d256651ab8e |
Complemento Comercio Exterior v1.1 (cce11 ). |
cfdv40-certdestruccion.xml | cfdv40-certdestruccion-cadena.txt | 7d565114453b4c4daa89dd09968d596a327950764d303297d6573a1bb5fee181 |
Complemento certificadodestruccion . |
cfdv40-consumodecombustibles11.xml | cfdv40-consumodecombustibles11-cadena.txt | 06afafe299479de5671403002bccd41f78dc9f8ff99d03d92d578c1de039be7a |
Complemento Consumo de Combustibles v1.1 (ConsumoDeCombustibles11 ). |
cfdv40-detallista.xml | cfdv40-detallista-cadena.txt | f6444d178cffb16282f16328d7ef8ba21fa2b2a1375e28a2032e3a1d44bee409 |
Complemento detallista . |
cfdv40-detallista-min.xml | cfdv40-detallista-min-cadena.txt | 0f25e57238cadb925fd3c46d5ea55f29b6d9b45ea0dc16e02200ae156ac51668 |
Minimum nodes required for detallista . |
cfdv40-divisas.xml | cfdv40-divisas-cadena.txt | de3cebe6578112a67361f023b0cdf695604402b4e98ccc0cf177f0cf871b00b3 |
Complemento para compraventa de divisas (divisas ). |
cfdv40-donat11.xml | cfdv40-donat11-cadena.txt | 93ca25f3d39c178b172a5bba276708f5540f6a321c3db67ebcaee11f82e1c6dc |
Complemento para donatarias (donat11 ). |
cfdv40-ecc12.xml | cfdv40-ecc12-cadena.txt | 10569b9fb137ff04018691f5144e1fab4609d366785769fb4c8b173abf82618a |
Complemento estado de cuenta de combustibles (ecc12 ). |
cfdv40-gceh.xml | cfdv40-gceh-cadena.txt | f7d474a67df76f7a8f3471beded98bd42725c7574f33002c6a4504f8467d81f6 |
Complemento GastosHidrocarburos10 . |
cfdv40-iedu.xml | cfdv40-iedu-cadena.txt | e47a55aba6852f38576988809aa729b9ad75e6f1fe7d5b0363a3ac02d40c2564 |
Complemento concepto de Instituciones Educativas Privadas (iedu ). |
cfdv40-ieeh.xml | cfdv40-ieeh-cadena.txt | e8045e98ac818229ad427d6320556395a07708b0e23ad3b1d6ceb7bc8e73f1df |
Complemento IngresosHidrocarburos10 . |
cfdv40-implocal.xml | cfdv40-implocal-cadena.txt | 6ea33b72175c1c2ad273dd95e3efc7b3ab773df65b09b5053de70b93f3d18159 |
Complemento para impuestos locales (implocal ). |
cfdv40-ine11.xml | cfdv40-ine11-cadena.txt | 3f0060620ac3c44909f56eb899072b985221c93d814d025f463ba1671eb9c6d6 |
Complemento ine11 . |
cfdv40-leyendasfisc.xml | cfdv40-leyendasfisc-cadena.txt | 499706077ee8c568fe2cf376e1ed27e4fa0bc6ec58edce5ebfa7b6b185237b2c |
Complemento leyendasFisc . |
cfdv40-nomina12.xml | cfdv40-nomina12-cadena.txt | 8c2645fed0e81761bac166afe7052dde752225132700a94679620dfd61bdd928 |
Complemento recibo de nómina v1.2 (nomina12 ). |
cfdv40-notariospublicos.xml | cfdv40-notariospublicos-cadena.txt | 66776e4f4a06616a9672f35980ce4e927745bb3f28c7f5b1c8ecb04d3a79da2f |
Complemento notariospublicos . |
cfdv40-obrasarte.xml | cfdv40-obrasarte-cadena.txt | 35474f7b58a1eb77c4e24c5d6048d2e38d1564ba89ed57b31cfd774565b1bc92 |
Complemento obrasarte . |
cfdv40-pagoenespecie.xml | cfdv40-pagoenespecie-cadena.txt | d815a6056fd4bccc20f7f8fb04ac39980473375eca67af863752a7f5e0deae2d |
Complemento pagoenespecie . |
cfdv40-pfic.xml | cfdv40-pfic-cadena.txt | 4ee20e1562dbf3878231036e008f5eb069aaabcfc778dd7ff8a971f35e60f4e0 |
Complemento persona física integrante de coordinado (pfic ). |
cfdv40-registrofiscal.xml | cfdv40-registrofiscal-cadena.txt | 1200276720726b4f75dd7a8a594d2087e3669a554a126960b9a2f37bbcb85dfa |
Complemento cfdiregistrofiscal . |
cfdv40-renovacionysustitucionvehiculos.xml | cfdv40-renovacionysustitucionvehiculos-cadena.txt | 3d630d62adb35a5a69e596a15a09daa31e16fcc658698ea0ca1db56137fd2a57 |
Complemento renovacionysustitucionvehiculos . |
cfdv40-servicioparcial.xml | cfdv40-servicioparcial-cadena.txt | 5c9759ce9308c7387ed394bb7045322bf18a5c87289a3c58e64ac3574d7f3845 |
Complemento servicioparcial . |
cfdv40-tpe.xml | cfdv40-tpe-cadena.txt | 94e3e9cdf3ed00d4206df734e83ed6e4ad1d41335d3dd7517cd4deeaa8bad56d |
Complemento de turista pasajero extranjero (tpe) . |
cfdv40-valesdedespensa.xml | cfdv40-valesdedespensa-cadena.txt | b7132b0aad1a4b3579ebd3586954115e256300f0816f0c1a1402ef00c1ceedcb |
Complemento valesdedespensa . |
cfdv40-vehiculousado.xml | cfdv40-vehiculousado-cadena.txt | 8d2179c74b445126f27cc895861c9a94e5c4e9aab2209f0ca40bfdbe8a2ba4e9 |
Complemento vehiculousado . |
cfdv40-venta11.xml | cfdv40-venta11-cadena.txt | 30d1fa9666d79ccd4246fb38d9764a13d0f34b04e7c8c970f3617b9f7aa850b6 |
Complemento concepto venta de vehículos nuevos (ventavehiculos11 ). |
If you think there is an error here, or if something is out of date, please send us a message.
cfdv40-ejemplo-signed-tfd.xml
is the file cfdv40-ejemplo.xml
signed by the holder of the
certificate with serial number 30001000000300023708
.
The corresponding private key
has password 12345678a
(files available in zip file below).
TimbreFiscalDigital
element in the file cfdv40-ejemplo-signed-tfd.xml
has been signed by the holder of the
certificate with serial number 30001000000300023699
.
The cadena original de un timbre (TFD pipe-string) has digest value
a276a2bf9d32066f2d553d67a99c6b016524ef90d699654be6eaa3f21f44a5e9
.
You can extract the pipe-string for the TFD using the "-f" option on the command line:
FirmaSAT PIPESTRING -f cfdv40-ejemplo-signed-tfd.xmland compute its digest value with
FirmaSAT FORMDIGEST -f cfdv40-ejemplo-signed-tfd.xml
Forming the cadena original (pipe-string) is the crucial part of computing the signature (sello) of the CFDi document. The signature is the SHA-256 digest value of the cadena original string signed (encrypted) by the signer's private key.
The signature is verified by re-constructing the cadena original from the XML document, computing its digest value, and checking that the value decrypted using the signer's public key is equal to this recomputed digest value.
It should be obvious that, if you cannot accurately and consistently form the cadena original, attempts to create and verify the signature will fail.
FirmaSAT PIPESTRING cfdv40-ejemplo.xml
||4.0|A|123ABC|...|Tasa|1.600000|360000|360000||To compute its digest value directly
FirmaSAT FORMDIGEST cfdv40-ejemplo.xml
c1492662dbd98ddbb7892d027c10808236e296eded13deec87179c2a8fdc742eTo save the cadenas originales for a set of XML documents as text files in the sub-directory
cadenas
for %f in (cfdv40*.xml) do @firmasat PIPESTRING -o cadenas\%~nf-cadena.txt %f(In a batch file, replace
%f
and %~nf
with %%f
and %%~nf
, respectively.)
To compute the digest values of all XML files in the current working directory
for %f in (cfdv40*.xml) do @echo/|set /p="%f " & @firmasat FORMDIGEST %f
cfdv40-ejemplo-signed-tfd.xml c1492662dbd98ddbb7892d027c10808236e296eded13deec87179c2a8fdc742e cfdv40-ejemplo-signed.xml c1492662dbd98ddbb7892d027c10808236e296eded13deec87179c2a8fdc742e cfdv40-ejemplo.xml c1492662dbd98ddbb7892d027c10808236e296eded13deec87179c2a8fdc742e cfdv40-min-signed.xml 51566373abf060f9fe79e2967ddc84bc4944c47f7e1346b3873aa62b1b2b15b0 ....
example-certs2021.zipSince CFD v1.0 was introduced in 2006, SAT has provided publicly-available sample keys and certificates for testing, but now they no longer do so (or if they do they keep it secret). The example certificates provided here are dummy certificates designed to look similar to SAT certificates for testing purposes. They are not issued officially by SAT, but they should work in exactly the same way as those that are.
Historical CFD v3.3 Examples from 2017.
To contact us or comment on this page, please send us a message.
This page first published 22 December 2021. Last updated 26 December 2021.