# 37. `example_cms_signed_data.py` — CMS SignedData Builder (RFC 5652)
[<- Example index](index.md) . [`example_cms_signed_data.py` on Codeberg](https://codeberg.org/abbra/synta/src/branch/main/examples/example_cms_signed_data.py)
Bindings: `synta.cms.SignedDataBuilder`, `synta.cms.ContentInfo`,
`synta.cms.SignedData`, `synta.cms.ID_SIGNED_DATA`,
`synta.PrivateKey`, `synta.CertificateBuilder`.
Requires the `openssl` or `nss` Cargo feature (key generation and signing).
- Create an **attached (encapsulating) SignedData** using
`cms.SignedDataBuilder(content)`: the content is embedded inside the
`encapContentInfo` field. Parse the result back with `ContentInfo.from_der()`
and `SignedData.from_der()`, inspect version, encapContentType, and
signer info digest/signature algorithm OIDs.
- Create a **detached SignedData** with `detached=True`: only the hash of the
content is signed; the `encap_content` field is `None`.
- Compare **SHA-256 vs SHA-384** digest algorithms by switching the
`hash_algorithm` parameter and inspecting the resulting `digest_algorithm_oid`
on each `SignerInfo`.