Skip to content

Latest commit

 

History

History
180 lines (126 loc) · 10.3 KB

File metadata and controls

180 lines (126 loc) · 10.3 KB

Encrypt

Version

0.1.0-preview

Implementations

Overview

This document describes the behavior by which a plaintext is encrypted and serialized into a message.

Any client provided by the AWS Encryption SDK that performs encryption of user plaintext MUST follow this specification for encryption.

Input

The following inputs to this behavior are REQUIRED:

The following as inputs to this behavior are OPTIONAL:

Plaintext

The plaintext to encrypt.

Encryption Context

See encryption context.

The encryption context MUST NOT contain an entry with a reserved key value.

CMM

A CMM that implements the CMM interface.

Keyring

A Keyring that implements the keyring interface.

Frame Length

The frame length to use for framed data. This value MUST NOT exceed the value 2^32 - 1.

Plaintext Length

A bound on the length of the plaintext to encrypt.

Output

This behavior MUST output the following if the behavior is successful:

This behavior MAY output the following:

To construct the outputs, some fields MUST be constructed using information obtained from a set of valid encryption materials. This behavior MUST obtain this set of encryption materials by calling Get Encryption Materials on a CMM. The CMM used MUST be the input CMM, if supplied. If instead the user supplied a keyring, this behavior MUST use a default CMM, constructed using the user supplied keyring as input. The call to Get Encryption Materials MUST include the input encryption context, if supplied. If the length is known on the input plaintext, this call MUST also include that value

The algorithm suite used in all aspects of this behavior MUST be the algorithm suite in the encryption materials returned from the Get Encryption Materials call.

The data key used as input for all encryption described below is a data key derived from the plaintext data key included in the encryption materials. The algorithm used to derive a data key from the plaintext data key MUST be the key derivation algorithm included in the algorithm suite defined above. This document refers to the output of the key derivation algorithm as the derived data key. Note that if the key derivation algorithm is the identity KDF, then the derived data key is the same as the plaintext data key.

Message

The output message MUST be bytes, as specified by the message format.

The message header is serialized with the following specifics:

Each frame of the message body is serialized with the following specifics:

If the algorithm suite contains a signature algorithm, the output message MUST contain a message footer. The footer is serialized with the following specifics:

Any data that is not specified within the message format MUST NOT be added to the output message.

Keyring Trace

The keyring trace obtained from the encryption materials.

Security Considerations

[TODO]

Appendix

Streaming

TODO: Implementations SHOULD support working with a finite amount of working memory for arbitrarly large plaintext. If size is not known, how do we set the bounds?

Un-Framed Message Body Encryption

Implementations of the AWS Encryption SDK MUST NOT encrypt using the Non-Framed content type. However, this behavior was supported in the past.

If a message has the non-framed content type, the message body was serialized with the following specifics: