Skip to content

Commit 539ee0f

Browse files
chore: Document encryption context interoperability for invalid UTF-8 (#820)
1 parent 07b4bd8 commit 539ee0f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

include/aws/cryptosdk/enc_ctx.h

+10
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ extern "C" {
3232
* for the most part, aws_hash_table methods are used to manipulate these structures,
3333
* but we provide some higher-level helper methods in this section. These helpers
3434
* will mostly be of interest to developers of custom CMMs or keyrings.
35+
*
36+
* The values provided to the encryption context SHOULD be UTF-8 bytes.
37+
* While it is technically possible to provide invalid UTF-8 bytes,
38+
* doing so is strongly discouraged.
39+
* Messages that include invalid UTF-8 bytes in their encryption context
40+
* will not be interoperable across different language implementations
41+
* of the AWS Encryption SDK.
42+
* The ESDK for C permits writing and reading encryption contexts that
43+
* contain invalid UTF-8 bytes, but ESDKs in other languages will neither
44+
* read nor write messages whose encryption context contains invalid UTF-8.
3545
* @{
3646
*/
3747

include/aws/cryptosdk/materials.h

+25
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ struct aws_cryptosdk_enc_request {
136136
* The encryption context for this message. CMMs are permitted to modify this
137137
* hash table in order to inject additional keys or otherwise modify the encryption
138138
* context.
139+
*
140+
* The values provided to the encryption context SHOULD be UTF-8 bytes.
141+
* While it is technically possible to provide invalid UTF-8 bytes,
142+
* doing so is strongly discouraged.
143+
* Messages that include invalid UTF-8 bytes in their encryption context
144+
* will not be interoperable across different language implementations
145+
* of the AWS Encryption SDK.
146+
* The ESDK for C permits writing and reading encryption contexts that
147+
* contain invalid UTF-8 bytes, but ESDKs in other languages will neither
148+
* read nor write messages whose encryption context contains invalid UTF-8.
139149
*/
140150
struct aws_hash_table *enc_ctx;
141151
/**
@@ -187,6 +197,21 @@ struct aws_cryptosdk_enc_materials {
187197
*/
188198
struct aws_cryptosdk_dec_request {
189199
struct aws_allocator *alloc;
200+
/**
201+
* The encryption context for this message. CMMs are permitted to modify this
202+
* hash table in order to inject additional keys or otherwise modify the encryption
203+
* context.
204+
*
205+
* The values provided to the encryption context SHOULD be UTF-8 bytes.
206+
* While it is technically possible to provide invalid UTF-8 bytes,
207+
* doing so is strongly discouraged.
208+
* Messages that include invalid UTF-8 bytes in their encryption context
209+
* will not be interoperable across different language implementations
210+
* of the AWS Encryption SDK.
211+
* The ESDK for C permits writing and reading encryption contexts that
212+
* contain invalid UTF-8 bytes, but ESDKs in other languages will neither
213+
* read nor write messages whose encryption context contains invalid UTF-8.
214+
*/
190215
const struct aws_hash_table *enc_ctx;
191216
struct aws_array_list encrypted_data_keys;
192217
enum aws_cryptosdk_alg_id alg;

0 commit comments

Comments
 (0)