What is a P7M file and how do you open it?
A P7M is an envelope containing a document and its digital signature. Here’s what’s inside and why an ordinary app can’t open it.
Guides
A file ending in .p7m is a digitally signed document in the CAdES format, the European standard for signatures based on CMS (Cryptographic Message Syntax, defined in RFC 5652). The extension comes from PKCS#7, the predecessor to CMS.
What’s inside
The envelope contains three things.
- The original document, identical byte for byte to the file that was signed. It can be an XML invoice, a PDF, a Word document or any other file.
- The signature, a value generated from a fingerprint (digest) of the document and the signer’s private key. The exact calculation depends on the signature algorithm.
- The signer’s certificate, issued by a certificate authority, with the signer’s name, often their codice fiscale (tax identification number), and the certificate’s validity period.
The .p7m extension is added to the original filename. A signed contract.pdf becomes contract.pdf.p7m, and a signed IT01234567890_00001.xml becomes IT01234567890_00001.xml.p7m.
Why double-clicking doesn’t open the document
The binary envelope holds the document, the signature and the certificate. A PDF reader or text editor can’t tell where the document starts. Removing .p7m from the filename usually won’t help. You need to extract the document from the envelope.
This tool opens the envelope in your browser, shows the signer’s details and lets you view or download the original document.
Multiple signatures
A document can be signed more than once. Sometimes the signatures share one envelope. In other cases the envelope itself is signed again and the filename becomes something like document.pdf.p7m.p7m. The viewer opens the envelopes in turn and tells you how many it found.
DER and Base64 encoding
An envelope can be stored in binary (DER) or as Base64 text. The files look different, but they carry the same contents. Some programs open only the binary version. This tool recognises both encodings.
Other signature formats
- PAdES embeds the signature in the PDF. The file still ends in
.pdfand opens in any PDF reader. - XAdES embeds the signature in XML. An Italian e-invoice signed this way keeps its
.xmlextension. - .p7s contains a detached signature. Open the accompanying document as a separate file.
- .tsd and .m7m also contain a timestamp that attests to the signing date. This site can’t open them yet.
Signature validity
A qualified digital signature has legal effect in Italy under the Codice dell’Amministrazione Digitale (Digital Administration Code, D.Lgs. 82/2005). Verification checks whether the document has changed since signing and whether the certificate was valid at the time, including whether it had expired or been revoked. This site only shows the details recorded in the file. For verification with legal effect, use signature verification software, such as a tool from a certificate authority.