Skip to content

Latest commit

 

History

History
185 lines (130 loc) · 8.96 KB

File metadata and controls

185 lines (130 loc) · 8.96 KB

Decrypt Item

Version

1.0.0

Changelog

  • 1.0.0

    • Initial record

Definitions

Conventions used in this document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Overview

This document describes the behavior by which the DynamoDB Item Encryptor decrypts a DynamoDB Item originally encrypted via the Encrypt Item operation.

Input

The following inputs to this behavior are REQUIRED:

Input DynamoDB Item

The DynamoDB Item is the item to be decrypted by this behavior.

This item MUST include an Attribute with a name that matches the DynamoDB Partition Key Name configured on the DynamoDB Item Encryptor. Otherwise this operation MUST yield an error.

If the DynamoDB Item Encryptor has a DynamoDB Sort Key Name configured, this item MUST include an Attribute with that name. Otherwise this operation MUST yield an error.

Output

This operation MUST output the following:

This operation MUST also output a Parsed Header if the following is true:

Output DynamoDB Item

The DynamoDB Item is the decryption of the [input DynamoBD Item](#input dynamodb-item).

Parsed Header

This structure MUST contain the following values, representing the deserialized form of the header of the input encrypted structure:

Behavior

If a Legacy Policy of FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT is configured, and the input item is an item written in the legacy format, this operation MUST fail.

If a Legacy Policy of FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT or FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT is configured, and the input item is an item written in the legacy format, this operation MUST delegate decryption of this item to the Legacy Encryptor, using the configured Attribute Flags as input. The item returned by this operation MUST be the item outputted by the Legacy Encryptor. Otherwise, this operations continues as follows.

If a Plaintext Policy of FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ or FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ is specified, and the input item is a plaintext item this operation MUST NOT decrypt the input item, and MUST passthrough that item as the output.

This behavior REQUIRES a Structured Data which is converted from the input DynamoDB Item.

This operation MUST create a Required Encryption Context CMM with the following inputs:

Given the converted Structured Data, this operation MUST delegate decryption of this data to Structured Encryption Client's Decrypt Structure, with the following inputs:

The output to this behavior is the conversion of the decrypted Structured Data determined above into the output DynamoDB Item.

The output MUST also include a Parsed Header that contains data that was serialized into the header included in the output DynamoDb Item.

DynamoDB Item Base Context

The item to be encrypted MUST have an attribute named aws_dbe_head.

The attribute named aws_dbe_head MUST be of type B Binary.

The first byte of that value is the Version Number.

If the Version Number is 2, then the base context MUST be the version 2 context.

If the Version Number is 1, the base context MUST be the version 1 context.

If the Version Number is not 1 or 2, the operation MUST return an error.

Signature Scope

The Signature Scope is a client-side configuration of what attributes should be included within signature calculations whenever encrypting or decrypting items.

An Attribute on a DynamoDB Item MUST NOT be considered as within the signature scope if it's Attribute Name is included in Unauthenticated Attributes or if it's Attribute Name begins with the prefix specified in Unauthenticated Attribute Prefix. Otherwise, Attributes MUST be considered as within the signature scope.

If an Authenticate Action other than DO_NOTHING is configured for an attribute name included in Unauthenticated Attributes or beginning with the prefix specified in Unauthenticated Attribute Prefix, this operation MUST yield an error.

Determining Legacy Items

An item MUST be determined to be encrypted under the legacy format if it contains attributes for the material description and the signature. These are usually "amzn-ddb-map-desc" and "amzn-ddb-map-sig" respectively, although the DynamoDbEncryptor allows callers to configure custom names for these attributes.

Determining Plaintext Items

An item MUST be determined to be plaintext if it does not contain attributes with the names "aws_dbe_head" and "aws_dbe_foot".

Note that this does not conflict with the legacy item definition, as there is no configuration state which needs to be able to distinguish between legacy items and plaintext items.