AWS SDK for C++

AWS SDK for C++ Version 1.11.719

Loading...
Searching...
No Matches
DataHandler.h
1
5#pragma once
6#include <aws/core/Aws.h>
7#include <aws/core/utils/crypto/ContentCryptoMaterial.h>
8#include <aws/s3-encryption/s3Encryption_EXPORTS.h>
9#include <aws/s3/model/GetObjectResult.h>
10#include <aws/s3/model/PutObjectRequest.h>
11#include <aws/s3/model/HeadObjectResult.h>
12
13namespace Aws
14{
15 namespace S3Encryption
16 {
17 static const char* const MetadataHandler_Tag = "MetadataHandler";
18 static const char* const DEPRECATED_CONTENT_KEY_HEADER = "x-amz-key";
19 static const char* const CONTENT_KEY_HEADER = "x-amz-key-v2";
20 static const char* const IV_HEADER = "x-amz-iv";
21 static const char* const MATERIALS_DESCRIPTION_HEADER = "x-amz-matdesc";
22 static const char* const CONTENT_CRYPTO_SCHEME_HEADER = "x-amz-cek-alg";
23 static const char* const CRYPTO_TAG_LENGTH_HEADER = "x-amz-tag-len";
24 static const char* const KEY_WRAP_ALGORITHM = "x-amz-wrap-alg";
25 static const char* const INSTRUCTION_FILE_HEADER = "x-amz-crypto-instr-file";
26
27 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
28 //= type=implication
29 //# - This mapkey ("x-amz-c") SHOULD be represented by a constant named "CONTENT_CIPHER_V3" or similar in the implementation code.
30
31 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
32 //= type=implication
33 //# - This mapkey ("x-amz-3") SHOULD be represented by a constant named "ENCRYPTED_DATA_KEY_V3" or similar in the implementation code.
34
35 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
36 //= type=implication
37 //# - This mapkey ("x-amz-m") SHOULD be represented by a constant named "MAT_DESC_V3" or similar in the implementation code.
38
39 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
40 //= type=implication
41 //# - This mapkey ("x-amz-t") SHOULD be represented by a constant named "ENCRYPTION_CONTEXT_V3" or similar in the implementation code.
42
43 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
44 //= type=implication
45 //# - This mapkey ("x-amz-w") SHOULD be represented by a constant named "ENCRYPTED_DATA_KEY_ALGORITHM_V3" or similar in the implementation code.
46
47 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
48 //= type=implication
49 //# - This mapkey ("x-amz-d") SHOULD be represented by a constant named "KEY_COMMITMENT_V3" or similar in the implementation code.
50
51 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
52 //= type=implication
53 //# - This mapkey ("x-amz-i") SHOULD be represented by a constant named "MESSAGE_ID_V3" or similar in the implementation code.
54
55 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
56 //= type=implication
57 //# The "x-amz-meta-" prefix is automatically added by the S3 server and MUST NOT be included in implementation code.
58
59 //= ../specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
60 //= type=implication
61 //# The "x-amz-" prefix denotes that the metadata is owned by an Amazon product and MUST be prepended to all S3EC metadata mapkeys.
62
63
64 static const char* const CONTENT_CIPHER_V3 = "x-amz-c"; // same as CONTENT_CRYPTO_SCHEME_HEADER
65 static const char* const ENCRYPTED_DATA_KEY_V3 = "x-amz-3"; // same as DEPRECATED_CONTENT_KEY_HEADER or CONTENT_KEY_HEADER
66 static const char* const MAT_DESC_V3 = "x-amz-m"; // same as MATERIALS_DESCRIPTION_HEADER
67 static const char* const ENCRYPTION_CONTEXT_V3 = "x-amz-t";
68 static const char* const ENCRYPTED_DATA_KEY_ALGORITHM_V3 = "x-amz-w"; // same as KEY_WRAP_ALGORITHM, but different encoding
69 static const char* const KEY_COMMITMENT_V3 = "x-amz-d";
70 static const char* const MESSAGE_ID_V3 = "x-amz-i";
71
72 static const size_t AES_GCM_IV_BYTES = 12;
73 static const size_t AES_GCM_KEY_BYTES = 32;
74 static const size_t AES_GCM_TAG_BYTES = 16;
75 static const size_t AES_KEY_WRAP_ENCRYPTED_CEK_BYTES = 40;
76
77 namespace Handlers
78 {
80 /*
81 Data handler class will be responsible for reading and writing metadata and instruction files to and from S3 object using a Put object
82 request or a Get object result.
83 */
84 class AWS_S3ENCRYPTION_API DataHandler
85 {
86 public:
87 /*
88 Function to json serialize a map containing pairs of strings.
89 */
91
92 /*
93 Function to deserialize a string to map.
94 */
96
97 protected:
98 /*
99 * Function to read meta data and return a content crypto material object.
100 */
102 };
103 }
104 }
105}
const Aws::String SerializeMap(const Aws::Map< Aws::String, Aws::String > &currentMap)
Aws::Utils::Crypto::ContentCryptoMaterial ReadMetadata(const Aws::Map< Aws::String, Aws::String > &metadata)
const Aws::Map< Aws::String, Aws::String > DeserializeMap(const Aws::String &jsonString)
Aws::String V2ToV3Alg(const Aws::String &v2)
static const size_t AES_GCM_IV_BYTES
Definition DataHandler.h:72
static const char *const CRYPTO_TAG_LENGTH_HEADER
Definition DataHandler.h:23
static const char *const ENCRYPTED_DATA_KEY_ALGORITHM_V3
Definition DataHandler.h:68
static const size_t AES_GCM_KEY_BYTES
Definition DataHandler.h:73
static const char *const IV_HEADER
Definition DataHandler.h:20
static const char *const MESSAGE_ID_V3
Definition DataHandler.h:70
static const size_t AES_GCM_TAG_BYTES
Definition DataHandler.h:74
static const char *const ENCRYPTED_DATA_KEY_V3
Definition DataHandler.h:65
static const char *const ENCRYPTION_CONTEXT_V3
Definition DataHandler.h:67
static const char *const MetadataHandler_Tag
Definition DataHandler.h:17
static const char *const MATERIALS_DESCRIPTION_HEADER
Definition DataHandler.h:21
static const char *const DEPRECATED_CONTENT_KEY_HEADER
Definition DataHandler.h:18
static const char *const MAT_DESC_V3
Definition DataHandler.h:66
static const char *const CONTENT_CIPHER_V3
Definition DataHandler.h:64
static const char *const KEY_COMMITMENT_V3
Definition DataHandler.h:69
static const char *const KEY_WRAP_ALGORITHM
Definition DataHandler.h:24
static const char *const INSTRUCTION_FILE_HEADER
Definition DataHandler.h:25
static const char *const CONTENT_CRYPTO_SCHEME_HEADER
Definition DataHandler.h:22
static const size_t AES_KEY_WRAP_ENCRYPTED_CEK_BYTES
Definition DataHandler.h:75
static const char *const CONTENT_KEY_HEADER
Definition DataHandler.h:19
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String