From Wikipedia, the free encyclopedia
Filename extension
.p7b, .p7s, .p7m, .p7c, .p7r
Developed byRSA Security
Latest release
1 March 1998; 25 years ago (1998-03-01)
Type of formatArchive file format
Container forX.509 public key certificates, X.509 CRLs

In cryptography, PKCS #7 ("PKCS #7: Cryptographic Message Syntax", "CMS") is a standard syntax for storing signed and/or encrypted data. PKCS #7 is one of the family of standards called Public-Key Cryptography Standards (PKCS) created by RSA Laboratories.


The latest version, 1.5, is available as RFC 2315.[1]

An update to PKCS #7 is described in RFC 2630,[2] which was replaced in turn by RFC 3369,[3] RFC 3852[4] and then by RFC 5652.[5]

PKCS #7 files may be stored both as raw DER format or as PEM format. PEM format is the same as DER format but wrapped inside Base64 encoding and sandwiched in between ‑‑‑‑‑BEGIN PKCS7‑‑‑‑‑ and ‑‑‑‑‑END PKCS7‑‑‑‑‑. Windows uses the .p7b file name extension[6] for both these encodings.

A typical use of a PKCS #7 file would be to store certificates and/or certificate revocation lists (CRL).

Here's an example of how to first download a certificate, then wrap it inside a PKCS #7 archive and then read from that archive:

$ echo '' | openssl s_client -connect -host 2>/dev/null | openssl x509 > 2>/dev/null

$ openssl crl2pkcs7 -nocrl -certfile -out

$ openssl pkcs7 -in -noout -print_certs
subject=C = US, ST = California, L = Los Angeles, O = Internet Corporation for Assigned Names and Numbers, OU = Technology, CN = issuer=C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA


  1. ^ RFC 2315 - Public-Key Cryptography Standards (PKCS) #7: Cryptographic Message Syntax Specification Version 1.5, March 1998
  2. ^ RFC 2630 - Cryptographic Message Syntax, June 1999
  3. ^ RFC 3369 - Cryptographic Message Syntax (CMS), August 2002
  4. ^ RFC 3852 - Cryptographic Message Syntax (CMS), July 2004
  5. ^ RFC 5652 - Cryptographic Message Syntax (CMS), September 2009
  6. ^ ".p7b Extension - List of Windows programs that can open .p7b files".

External links[edit]