AWS Encryption SDK for C v2.4
Loading...
Searching...
No Matches
Encryption Context utilities

Functions

int aws_cryptosdk_enc_ctx_init (struct aws_allocator *alloc, struct aws_hash_table *enc_ctx)
 
void aws_cryptosdk_enc_ctx_clear (struct aws_hash_table *enc_ctx)
 
void aws_cryptosdk_enc_ctx_clean_up (struct aws_hash_table *enc_ctx)
 
int aws_cryptosdk_enc_ctx_clone (struct aws_allocator *alloc, struct aws_hash_table *dest, const struct aws_hash_table *src)
 

Detailed Description

The encryption context is a string-to-string map of contextual information that is cryptographically bound to the message. We represent the encryption context as an aws_hash_table mapping from aws_string * to aws_string *; for the most part, aws_hash_table methods are used to manipulate these structures, but we provide some higher-level helper methods in this section. These helpers will mostly be of interest to developers of custom CMMs or keyrings.

Function Documentation

◆ aws_cryptosdk_enc_ctx_clean_up()

void aws_cryptosdk_enc_ctx_clean_up ( struct aws_hash_table * enc_ctx)

Deallocate an encryption context. This is equivalent to aws_hash_table_clean_up, but provided as an alias for clarity.

Definition at line 64 of file enc_ctx.h.

◆ aws_cryptosdk_enc_ctx_clear()

void aws_cryptosdk_enc_ctx_clear ( struct aws_hash_table * enc_ctx)

Clear the elements of an encryption context without deallocating the hash table. This is equivalent to aws_hash_table_clear, but provided as an alias for clarity.

Definition at line 54 of file enc_ctx.h.

◆ aws_cryptosdk_enc_ctx_clone()

int aws_cryptosdk_enc_ctx_clone ( struct aws_allocator * alloc,
struct aws_hash_table * dest,
const struct aws_hash_table * src )

Copies the contents of the 'src' encryption context into the 'dest' encryption context. 'dest' must be pre-allocated.

This method will reuse pre-existing entries in dest that match the values in src, and will also reuse aws_strings with a NULL allocator in src. Any other values will be copied into newly allocated memory using the given allocator.

If this function returns an error, the contents of dest are unspecified, but are in a state where aws_cryptosdk_enc_ctx_clear or aws_cryptosdk_enc_ctx_clean_up can be safely used without leaking memory.

◆ aws_cryptosdk_enc_ctx_init()

int aws_cryptosdk_enc_ctx_init ( struct aws_allocator * alloc,
struct aws_hash_table * enc_ctx )

Initialize an encryption context, which is just an AWS hash table that uses AWS strings as keys and values. The hash table will call aws_string_destroy to destroy keys and values on destruction of the hash table itself.

See aws/common/hash_table.h for the interface to AWS hash tables, and aws/common/string.h for the interface to AWS strings.