CMS is defined in RFC 3369 and is an continuation of the RSA Labs standard PKCS7. The basic messages in CMS is
- SignedData Data signed with private key (RSA, DSA, ECDSA) or secret (symmetric) key
 - EnvelopedData Data encrypted with private key (RSA)
 - EncryptedData Data encrypted with secret (symmetric) key.
 - ContentInfo Wrapper structure including type and data.
 
See the library functions here: hx509 CMS/pkcs7 functions