# Is PKCS7 a signature format or a certificate format?

I always though PKCS7 was a signature format.

However, on the net I find several references to PKCS7 being a certificate format - for example, this talks about PKCS7 certificate: Extract raw certificate from PKCS#7 file in JAVA

So is PKCS7 a signature format or a certificate format or both?

## 1 Answer

So is PKCS7 a signature format or a certificate format or both?

Neither. PKCS7 is now Cryptographic Message Syntax(CMS). From the RFC 5652:

This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content.

CMS enables interoperability between different products which can operate on the same document without knowing anything about other product (implementation and such other specific info related to the product). CMS achieves this by defining specific message formats for each data type (signed data, enveloped data, authenticated enveloped data). Hence, each product which support CMS format can exchange files or messages defined in the CMS format with no trouble.

The second link you provided also talks about CMS format.

After comments from @Maarten:

It is also worth to mention that PKCS stands for "Public Key Cryptography Standards". These are a set of public key cryptography standards created by RSA Security Inc. Some of these standards handed over to standards organizations and they became industry standards after that.

Also, as @Maarten mentions, using CMS(PKCS7) format enables storing more than one certificate. (Check this answer)

• Nice answer. You may possibly improve it by explaining that PKCS means Public Key Cryptographic Standard, which is a set of standards from RSA Laboratories (and PKCS #7 in full is the 7th standard). Furthermore you might mention that CMS may contain signing and intermediate certificates. (sorry, previous comment was too strongly worded). – Maarten Bodewes Jun 15 '16 at 7:39
• @MaartenBodewes Thanks for comment, i've edited my answer. Also, feel free to edit my answer as you like if there are some points still missing. – Makif Jun 15 '16 at 9:16
• Can you have a PKCS file which is just a certificate & does not contain any signature (other than signature which is part of the certificate itself)? That is my main question - so if I wasn't clear enough? – user93353 Jun 15 '16 at 14:02
• From this answer:The .p7b or .p7c format is a special case of PKCS#7/CMS: a SignedData structure containing no "content" and zero SignerInfos, but one or more certificates (usually) and/or CRLs (rarely). So, this format enables storing only certificates. – Makif Jun 15 '16 at 20:44
• @Makif Good to know! Mind you, this is an extremely hackish way, because you would still mark it as signed content. PKCS#12 can also be used and encoded as PEM; PKCS#12 is a trust/key store format and would make a lot more sense. – Maarten Bodewes Jun 16 '16 at 21:45