How does the viewer unwrap CAdES .xml.p7m envelopes locally?
This FatturaPA viewer (visualizzatore fattura elettronica) inspects the leading bytes of your .xml.p7m file, strips optional Base64 or PEM headers, and walks the ASN.1 TLV structure inside a Web Worker until it locates the embedded <FatturaElettronica> XML bytes. Zero bytes leave your computer during unwrapping or PDF generation.
Decoding DER, BER indefinite-length, and Base64 .p7m files
Italian signing software produces .p7m envelopes in several valid variants under the IETF RFC 5652 Cryptographic Message Syntax standard. Some tools emit strict DER octet strings, while others emit Base64-wrapped payloads or BER indefinite-length (0x80) constructed octet strings (0x24).
Our ASN.1 reader inspects constructed envelopes up to depth 24, collects chunked octet strings, and skips indefinite-length terminators cleanly. You do not need to install Aruba, InfoCert, or desktop Java utilities just to read an incoming supplier .p7m invoice. If you also inspect pan-European UBL, CII, or Factur-X invoices, open them in our browser-based e-invoice viewer.
Handling UTF-8 and legacy Windows-1252 XML encodings
Once extracted, the decoder reads the XML declaration encoding attribute before converting bytes to text. Files declared as ISO-8859-1, Latin1, or Windows-1252 are decoded accurately alongside standard UTF-8, preserving accented Italian descriptions and euro symbols.
Central European supplier invoices declared as ISO-8859-2 or Windows-1250 are decoded as well, preventing garbled characters in item tables. Trailing whitespace or PEM armor headers around Base64-encoded .p7m attachments are stripped automatically before ASN.1 parsing begins.
FPA12, FPR12, and SdI transmission fields explained
Every FatturaPA file carries routing and tax-regime metadata inside <FatturaElettronicaHeader> and <DatiGeneraliDocumento>. According to the FatturaPA Official XML Format Documentation, <FormatoTrasmissione> distinguishes public-sector FPA12, private FPR12, and simplified FSM10 invoices.
Each transmission block also identifies the document type (TD01 standard invoice, TD04 credit note, TD24 deferred invoice, or TD06 professional fee), payment method (MP05 wire transfer, MP08 card, MP19 SEPA direct debit), and seller regime.
| XML field or code | Role in FatturaPA | How the viewer displays it |
|---|---|---|
FPA12 / FPR12 / FSM10 |
SdI transmission format | Shown in the top format bar and Schema details |
CodiceDestinatario |
6-char PA or 7-char B2B routing code | Displayed under Schema details and Buyer reference |
PECDestinatario |
Certified email fallback (0000000) |
Listed under Schema details when populated |
TipoDocumento (TD01–TD25) |
Invoice, credit note, deferred invoice | Mapped to UNTDID codes (380, 381, 386, 389) |
RegimeFiscale (RF01–RF19) |
Seller’s Italian tax regime | Shown in Schema details for quick audit checks |
Before posting a vendor or customer invoice into your accounting ledger, you can validate 11-digit Italian Partita IVA checksums offline to catch transposed digits.
Ritenuta d’acconto, split payment IVA, and Natura codes
Italian invoices frequently include statutory deductions and zero-rate exemptions that differ from standard VAT math. Under the Agenzia delle Entrate Fatturazione Elettronica Portal, Sistema di Interscambio (SdI) enforces strict validation rules on these blocks.
Reconciling DatiRitenuta and PA split payment against ImportoPagamento
Professional invoices subject to ritenuta d'acconto (<DatiRitenuta>) require the buyer to withhold income tax and pay the net balance. Similarly, invoices to public administrations marked EsigibilitaIVA = S (scissione dei pagamenti) transfer VAT payment directly to the state.
This viewer subtracts both DatiRitenuta and split-payment VAT from the gross document total so the net balance matches <ImportoPagamento> in <DatiPagamento>. Purchase order IDs from <DatiOrdineAcquisto> along with CIG and CUP public tender codes appear in the header, complementing workflows where you prepare supplier purchase orders before billing.
Mapping Natura codes N1 through N7 and Bollo virtuale
When a line item or summary block carries 0% VAT, Italian law requires a <Natura> code explaining the exemption. The parser maps N1 and N2 to outside-scope (O), N3.1 to exports (G), N3.2 to intra-EU supplies (K), N4, N5, and N7 to exempt (E), and N6 to reverse charge (AE).
If <DatiBollo> indicates virtual stamp duty (Bollo virtuale), the viewer displays the 2.00 EUR (or stated) stamp duty in Schema details and accounts for it in <ImportoPagamento>.
Saving readable PDFs and unwrapped XML copies
After opening a file (aprire xml.p7m or plain .xml), the Checks section validates totals, VAT breakdowns, and mandatory party fields against core EN 16931 rules.
Exporting printable PDFs and clean .xml payloads
Click Save as PDF to render a clean A4 invoice PDF inside a Web Worker, or click Full preview to inspect the pages before saving. Clicking Download unwrapped XML saves the extracted .xml file locally whenever you opened a .xml.p7m envelope, ready for ERP import or bookkeeping review.
Tip: Always archive the original signed
.xml.p7mfile alongside the readable PDF, because Italian statutory retention (conservazione sostitutiva) requires preserving the signed electronic original for 10 years.
Archival retention and cryptographic signature boundaries
All ASN.1 unwrapping, XML decoding, and PDF rendering execute locally with 0 KB sent over the network, keeping sensitive supplier pricing, Partita IVA identifiers, and IBAN coordinates private on your device. If you also review Spanish electronic invoices in .xml or XAdES .xsig format, open them in our Facturae XML viewer.
Note that this viewer inspects XML fields and arithmetic for operational convenience rather than certified legal or tax advice; use official SdI or qualified trust services when formal CAdES signature verification is required.