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?

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.

• 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