What is a .p7m file? Meaning, contents and how to read it

A .p7m attachment arrives from an accountant, a supplier or a PEC mailbox and nothing on your phone or computer knows what to do with it. The file is not corrupt. It is a wrapper.

Updated

On this page
  1. From difficult file to readable document.
  2. What a P7M file actually is
  3. P7M, P7S and smime.p7m compared
  4. Why it does not open like a PDF
  5. What you can and cannot learn from the file
  6. Why privacy matters for P7M files
  7. Where P7M files come from
  8. A quick checklist when a P7M will not open
  9. Opening a P7M on iPhone, iPad and Mac
  10. If the document does not display as expected
  11. Questions about this file type.

From difficult file to readable document.

  1. Read the full filename

    Names such as invoice.xml.p7m or contract.pdf.p7m usually reveal what is inside. The part before .p7m is a hint about the payload, not a guarantee.

  2. Keep the original untouched

    Save the .p7m exactly as received. Renaming it to .pdf or .xml does not extract anything and can hide the fact that the document was signed.

  3. Open it with a P7M-aware app

    In EU Docs, choose the file from Files or Finder. The app lists the embedded document, shows a preview of supported PDF and XML content and lets you save a separate copy of the payload.

What a P7M file actually is

P7M stands for PKCS #7 message, the older name of the Cryptographic Message Syntax (CMS) standardised in RFC 5652. In a P7M that carries a signature, the original document is stored inside the same file together with the signature and the signer’s certificate information. This is called an enveloping or attached signature.

In Italy and several other European countries, P7M is the everyday form of a CAdES-signed document. Electronic invoices sent through the Italian SdI system, certified email (PEC) attachments and many contracts arrive this way.

P7M, P7S and smime.p7m compared

The three names appear in similar situations but behave differently.

NameWhat it usually isDocument inside?
file.pdf.p7mSigned envelope around a PDFYes, stored inside the .p7m
file.xml.p7mSigned envelope around an XML invoiceYes, stored inside the .p7m
file.p7sDetached signature kept next to the originalNo, the original is a separate file
smime.p7mAttachment created by an S/MIME email client (RFC 8551)Depends: it can be signed or encrypted mail content

Why it does not open like a PDF

A PDF reader expects PDF bytes at the start of the file. A P7M starts with signature structures, so the reader refuses it or shows an error even when the PDF inside is perfectly fine. The same is true for XML editors: they will not find an XML declaration until the envelope is removed.

Some P7M files are layered. A .xml.p7m.p7m, for example, has been signed twice. A proper opener keeps unwrapping until it reaches the real payload.

What you can and cannot learn from the file

EU Docs checks supported CAdES signatures offline against the EU trusted lists bundled in the app. It reports separately whether the signature matches the document, whether the signer’s certificate chains to a provider on those lists and is qualified, whether it was valid at signing time, whether a timestamp is trusted and which signature level (B, T, LT or LTA) is present.

That helps you spot problems quickly, but it is not an official validation. If a legal or tax decision depends on the signature, use an official validation service such as the EU DSS validation service or the AgID verifier, and keep the original .p7m.

An encrypted S/MIME message is a different case: it cannot be read without the recipient’s private key, whichever app you use.

Why privacy matters for P7M files

Signed invoices and contracts contain names, addresses, tax numbers and prices. Many free online P7M converters ask you to upload the file. EU Docs processes the file on your iPhone, iPad or Mac and has no document-upload workflow.

Where P7M files come from

The most common sources are Italian electronic invoices delivered through the SdI platform, PEC certified-email attachments, notarial and accountancy documents, and tenders or public-administration notices. If a colleague says “the invoice came as a p7m”, they mean a FatturaPA XML wrapped in a CAdES signature.

Email clients can also create P7M files. When a mail program signs a message with S/MIME, the recipient may see an attachment called smime.p7m, which holds the signed message body rather than a business document. That file is usually harmless noise; the real attachments are inside it.

A quick checklist when a P7M will not open

First check that the download is complete: a P7M that is a few bytes long or ends mid-transfer cannot be unwrapped. Second, check whether the file is really a detached signature (.p7s) that should sit next to an original document. Third, look at the filename for a double extension that reveals the payload type. Finally, if the envelope opens but the payload is an unsupported or proprietary format, identify that format and use a reader made for it.

Do not try to repair the file with a text editor. Signed data is sensitive to a single changed byte, and editing it can destroy the signature even if the content still looks fine.

Opening a P7M on iPhone, iPad and Mac

On iPhone and iPad, save the attachment to Files or use Share from Mail. On a Mac, start from Finder. EU Docs lets you read supported PDF and XML payloads and save a separate copy of the document you need.

If the document does not display as expected

Keep the original filename and check that the download is complete. Renaming XML, P7M or ASiC files to PDF does not convert them. If a signed container opens, check the type of its extracted payload: it may be an invoice, PDF or another format requiring its own reader.

For an invoice, compare the document identifier, supplier, currency, tax and total with the original fields. Report an unsupported format with its non-sensitive format/version details; avoid sending private documents unless you choose an appropriate support channel.

Authoritative references

Official specifications and public-sector documentation used to check the terminology in this guide.

Questions about this file type.

Is a .p7m file safe to open?

The envelope is a data container, not a program. As with any email attachment, open it only when you trust the sender, because the document inside can be a PDF or other file type with its own risks.

Can I just rename .p7m to .pdf?

No. Renaming does not remove the signature wrapper, so the file still will not open as a PDF. Use a P7M-aware tool to extract the document.

What is the difference between .p7m and .p7s?

A .p7m contains the signed document inside it. A .p7s is a detached signature stored separately from the original document; on its own it shows signature data but not the document.

Does EU Docs work offline?

Yes. Opening, parsing and the signature check run on the device, and the app never connects to the internet to check revocation, so revocation status is shown only when the signature carries that data.