Skip to main content

Module cms

Module cms 

Source
Expand description

CMS (RFC 5652) — Cryptographic Message Syntax.

CmsContentInfo wraps CMS_ContentInfo* and covers the SignedData content type used in modern PKI: signing a payload with an X.509 certificate, verifying a signed message against a trust store, and extracting the embedded certificates and CRLs.

§Quick example

let payload = b"hello, PKINIT";
let signed = CmsContentInfo::sign(cert, key, &[], payload, CmsSignFlags::NONE)?;
let der = signed.to_der()?;

let parsed = CmsContentInfo::from_der(&der)?;
let content = parsed.verify(store, &[], CmsVerifyFlags::NONE)?;
assert_eq!(content, payload);

Structs§

CmsContentInfo
An owned CMS_ContentInfo* — the top-level CMS container.
CmsSignFlags
Flags that control CmsContentInfo::sign.
CmsSignerInfo
A borrowed reference to a CMS_SignerInfo within a CmsContentInfo.
CmsVerifyFlags
Flags that control CmsContentInfo::verify.