# `Cmsex.EnvelopedData`
[🔗](https://github.com/openspb/cmsex/blob/v0.1.0/lib/cmsex/enveloped_data.ex#L1)

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.

Fields:

  * `:type` - `:enveloped_data`, or `:auth_enveloped_data` for content
    encrypted with an authenticated cipher, such as AES-GCM.
  * `:version` - the version written in the message.
  * `:recipient_infos` - the recipients, a list of `Cmsex.RecipientInfo`.
  * `:content_type` - the type of the encrypted content, as a name of
    `Cmsex.OID`, such as `:data`, or an OID.
  * `:content_encryption_algorithm` - the name of the cipher in
    `Cmsex.OID`, such as `:aes256_cbc` or `:aes256_gcm`, or its OID.
  * `:encrypted_content` - the ciphertext, its segments joined when the
    message was written in BER, or `nil` when it is not in the message.
  * `:certificates`, `:other_certificates`, `:crls`, `:other_crls` - the
    OriginatorInfo, as in `Cmsex.SignedData`; empty when it is absent.
  * `:authenticated_attributes` - for `:auth_enveloped_data`, the
    attributes the tag covers, a list of `Cmsex.Attribute`, or `nil`.
  * `:mac` - for `:auth_enveloped_data`, the tag; `nil` otherwise.
  * `:unprotected_attributes` - the unprotectedAttrs of an EnvelopedData,
    or the unauthAttrs of an AuthEnvelopedData: attributes that nothing
    protects, empty when there are none.
  * `:deviations` - what the library tolerated when reading, against
    RFC 5652 and RFC 5083: `:enveloped_data_version` when the version is
    not the one the fields call for. The recipients have their own.

# `t`

```elixir
@type t() :: %Cmsex.EnvelopedData{
  authenticated_attributes: [Cmsex.Attribute.t()] | nil,
  certificates: [binary()],
  content_encryption_algorithm: atom() | tuple(),
  content_type: atom() | tuple(),
  crls: [binary()],
  deviations: [atom()],
  encrypted_content: binary() | nil,
  mac: binary() | nil,
  other_certificates: [binary()],
  other_crls: [binary()],
  raw: map() | nil,
  recipient_infos: [Cmsex.RecipientInfo.t()],
  type: :enveloped_data | :auth_enveloped_data,
  unprotected_attributes: [Cmsex.Attribute.t()],
  version: integer()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
