AwsEncryptionSdk.Format.Message (AWS Encryption SDK v1.0.0)

View Source

Complete message serialization and deserialization.

An AWS Encryption SDK message consists of:

  1. Header - Contains algorithm suite, message ID, encryption context, EDKs
  2. Body - Encrypted content (framed or non-framed)
  3. Footer - Optional ECDSA signature (only for signed algorithm suites)

Message Structure

+--------+--------+--------+
| Header | Body   | Footer |
+--------+--------+--------+
                  ^
                  |
                  Only present for signed suites

Summary

Types

Framed message body content

Non-framed message body content

t()

Complete message structure

Functions

Deserializes a complete message from binary data.

Checks if a message requires a footer based on its algorithm suite.

Types

framed_body()

@type framed_body() :: [AwsEncryptionSdk.Format.Body.frame()]

Framed message body content

non_framed_body()

@type non_framed_body() :: AwsEncryptionSdk.Format.Body.non_framed()

Non-framed message body content

t()

@type t() :: %{
  header: AwsEncryptionSdk.Format.Header.t(),
  body: non_framed_body() | framed_body(),
  footer: %{signature: binary()} | nil
}

Complete message structure

Functions

deserialize(data)

@spec deserialize(binary()) :: {:ok, t(), binary()} | {:error, term()}

Deserializes a complete message from binary data.

Returns {:ok, message, rest} on success.

requires_footer?(header)

@spec requires_footer?(AwsEncryptionSdk.Format.Header.t()) :: boolean()

Checks if a message requires a footer based on its algorithm suite.