# cmsex v0.1.0 - API Reference

## Modules

- [Cmsex](Cmsex.md): Cryptographic Message Syntax (CMS, RFC 5652) in pure Elixir: the signed,
encrypted and other messages of S/MIME, of `.p7s`, `.p7m` and `.p7b`
files, and of the many systems built on them.
- [Cmsex.Attribute](Cmsex.Attribute.md): A signed or unsigned attribute of a signer (RFC 5652, 5.3): a type and its
values.
- [Cmsex.Authenticated](Cmsex.Authenticated.md): An AuthenticatedData message whose MAC `Cmsex.verify_mac/2` checked.
- [Cmsex.AuthenticatedData](Cmsex.AuthenticatedData.md): An AuthenticatedData message, as `Cmsex.decode/2` reads it (RFC 5652, 9):
a content and a MAC over it, with the MAC key sent to each recipient as
in EnvelopedData. The content is not encrypted. `Cmsex.verify_mac/2`
checks it.
- [Cmsex.Decrypted](Cmsex.Decrypted.md): A message that `Cmsex.decrypt/2` decrypted.
- [Cmsex.DigestedData](Cmsex.DigestedData.md): A DigestedData message, as `Cmsex.decode/2` reads it (RFC 5652, 7): a
content and its digest, which shows it was not changed by accident, and
nothing more: anyone can write a new digest. `Cmsex.verify_digest/2`
checks it.
- [Cmsex.EncryptedData](Cmsex.EncryptedData.md): An EncryptedData message, as `Cmsex.decode/2` reads it (RFC 5652, 8):
content encrypted with a key the parties manage by other means, with no
recipients. `Cmsex.decrypt/2` with `:content_key` decrypts it.
- [Cmsex.EnvelopedData](Cmsex.EnvelopedData.md): An EnvelopedData (RFC 5652, 6) or AuthEnvelopedData (RFC 5083) message,
as `Cmsex.decode/2` reads it. Reading checks the structure only;
`Cmsex.decrypt/2` decrypts.
- [Cmsex.KeyWrap](Cmsex.KeyWrap.md): The AES key wrap of RFC 3394, and AES key wrap with padding of RFC 5649.
- [Cmsex.OID](Cmsex.OID.md): The object identifiers this library knows by name.
- [Cmsex.PEM](Cmsex.PEM.md): The textual encoding of CMS messages (RFC 7468): Base64 between
`-----BEGIN CMS-----` and `-----END CMS-----` lines.
- [Cmsex.Recipient](Cmsex.Recipient.md): A recipient for `Cmsex.encrypt/3` and `Cmsex.mac/3`: who can decrypt the
message, or check its MAC, and how the key reaches them (RFC 5652, 6.2).
Build it with one of the functions here; both functions also take a
certificate in DER as a recipient of `certificate/2` with the defaults.
- [Cmsex.RecipientInfo](Cmsex.RecipientInfo.md): One recipient of an EnvelopedData, AuthEnvelopedData or AuthenticatedData
message, as `Cmsex.decode/2` reads it (RFC 5652, 6.2): the means by which
that recipient gets the content-encryption key.
- [Cmsex.SignedData](Cmsex.SignedData.md): A SignedData message, as `Cmsex.decode/2` reads it (RFC 5652, 5).
Reading checks the structure only; `Cmsex.verify/2` checks the
signatures.
- [Cmsex.Signer](Cmsex.Signer.md): A signer for `Cmsex.sign/3`: a certificate, its private key, and how to
sign. `Cmsex.sign/3` also takes it as a plain map or keyword list with
the same fields, and turns it into this struct, whose `Inspect` leaves
the key out.
- [Cmsex.SignerInfo](Cmsex.SignerInfo.md): One signer of a SignedData message, as `Cmsex.decode/2` reads it
(RFC 5652, 5.3). Reading checks the structure only; `Cmsex.verify/2`
checks the signature.
- [Cmsex.Verified](Cmsex.Verified.md): The result of `Cmsex.verify/2`.

- Exceptions
  - [Cmsex.Error](Cmsex.Error.md): Why a CMS message could not be read, verified, written or decrypted.

