PKCS 7

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.

Standard
The latest version, 1.5, is available as RFC 2315.

An update to PKCS #7 is described in RFC 2630, which was replaced in turn by RFC 3369, RFC 3852 and then by RFC 5652.

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  file name extension 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:

File types

 * – response to CSR. Contains the newly-signed certificate, and the CA's own cert.
 * - Digital Signature. May contain the original signed file or message. Used in S/MIME for email signing. Defined in RFC 2311.
 * - Message (SignedData, EnvelopedData) e.g. encrypted ("enveloped") file, message or MIME email letter. Defined in RFC 2311.
 * - degenerated SignedData "certs-only" structure, without any data to sign. Defined in RFC 2311.
 * - SignedData structure without data, just certificate(s) bundle and/or CRLs (rarely) but not a private key. Uses DER form or BER or PEM that starts with -BEGIN PKCS7-. The format used by Windows for certificate interchange. Supported by Java but often has  as an extension instead. Unlike   style certificates, this format has a defined way to include certification-path certificates.