AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
ContentCryptoMaterial.h
1
5#pragma once
6
7#include <aws/core/Aws.h>
8#include <aws/core/Core_EXPORTS.h>
9#include <aws/core/utils/crypto/CryptoBuf.h>
10#include <aws/core/utils/crypto/ContentCryptoScheme.h>
11#include <aws/core/utils/crypto/KeyWrapAlgorithm.h>
12
13namespace Aws
14{
15 namespace Utils
16 {
17 namespace Crypto
18 {
19 class AWS_CORE_API ContentCryptoMaterial
20 {
21 public:
22 /*
23 Default constructor.
24 */
26 /*
27 Initialize content crypto material with content crypto scheme. Constructor will also generate the cek automatically.
28 Since the creation of the crypto content material will be within the S3 crypto modules, only the crypto scheme is needed for initialization.
29 The rest of the data will be set using the accessors below.
30 */
32
33 /*
34 Initialize with content encryption key (cek) and content crypto scheme.
35 */
37
42 {
43 return m_contentEncryptionKey;
44 }
45
50 {
51 return m_encryptedContentEncryptionKey;
52 }
53
57 inline const Aws::Utils::CryptoBuffer& GetIV() const
58 {
59 return m_iv;
60 }
61
65 inline size_t GetCryptoTagLength() const
66 {
67 return m_cryptoTagLength;
68 }
69
74 {
75 return m_materialsDescription;
76 }
77
78 /*
79 * Gets the value of the key in the current materials description map.
80 */
81 inline const Aws::String& GetMaterialsDescription(const Aws::String& key) const
82 {
83 return m_materialsDescription.at(key);
84 }
85
90 {
91 return m_keyWrapAlgorithm;
92 }
93
98 {
99 return m_contentCryptoScheme;
100 }
101
105 inline void SetContentEncryptionKey(const Aws::Utils::CryptoBuffer& contentEncryptionKey)
106 {
107 m_contentEncryptionKey = contentEncryptionKey;
108 }
109
113 inline void SetEncryptedContentEncryptionKey(const Aws::Utils::CryptoBuffer& encryptedContentEncryptionKey)
114 {
115 m_encryptedContentEncryptionKey = encryptedContentEncryptionKey;
116 }
117
121 inline void SetIV(const Aws::Utils::CryptoBuffer& iv)
122 {
123 m_iv = iv;
124 }
125
129 inline void SetCryptoTagLength(size_t cryptoTagLength)
130 {
131 m_cryptoTagLength = cryptoTagLength;
132 }
133
137 inline void AddMaterialsDescription(const Aws::String& key, const Aws::String& value)
138 {
139 m_materialsDescription[key] = value;
140 }
141
145 inline void SetMaterialsDescription(const Aws::Map<Aws::String, Aws::String>& materialsDescription)
146 {
147 m_materialsDescription = materialsDescription;
148 }
149
153 inline void SetKeyWrapAlgorithm(KeyWrapAlgorithm keyWrapAlgorithm)
154 {
155 m_keyWrapAlgorithm = keyWrapAlgorithm;
156 }
157
161 inline void SetContentCryptoScheme(ContentCryptoScheme contentCryptoScheme)
162 {
163 m_contentCryptoScheme = contentCryptoScheme;
164 }
165
169 inline void SetGCMAAD(const Aws::Utils::CryptoBuffer& aad)
170 {
171 m_gcmAAD = aad;
172 }
177 {
178 return m_gcmAAD;
179 }
180
185 {
186 m_cekGCMTag = tag;
187 }
192 {
193 return m_cekGCMTag;
194 }
195
199 inline void SetCekIV(const Aws::Utils::CryptoBuffer& iv)
200 {
201 m_cekIV = iv;
202 }
206 inline const Aws::Utils::CryptoBuffer& GetCekIV() const
207 {
208 return m_cekIV;
209 }
210
214 inline void SetFinalCEK(const Aws::Utils::CryptoBuffer& finalCEK)
215 {
216 m_finalCEK = finalCEK;
217 }
222 {
223 return m_finalCEK;
224 }
225
226 private:
227 Aws::Utils::CryptoBuffer m_contentEncryptionKey;
228 Aws::Utils::CryptoBuffer m_encryptedContentEncryptionKey;
229 /* if using AES_GCM key wrap algorithm, then final CEK is iv + encrypted_key + tag
230 * otherwise it's the same as m_encryptedContentEncryptionKey
231 */
232 Aws::Utils::CryptoBuffer m_finalCEK;
236 Aws::Utils::CryptoBuffer m_cekGCMTag;
237 size_t m_cryptoTagLength;
238 Aws::Map<Aws::String, Aws::String> m_materialsDescription;
239 KeyWrapAlgorithm m_keyWrapAlgorithm;
240 ContentCryptoScheme m_contentCryptoScheme;
241 };
242 }
243 }
244}
void SetMaterialsDescription(const Aws::Map< Aws::String, Aws::String > &materialsDescription)
void AddMaterialsDescription(const Aws::String &key, const Aws::String &value)
void SetFinalCEK(const Aws::Utils::CryptoBuffer &finalCEK)
void SetGCMAAD(const Aws::Utils::CryptoBuffer &aad)
const Aws::Utils::CryptoBuffer & GetEncryptedContentEncryptionKey() const
const Aws::String & GetMaterialsDescription(const Aws::String &key) const
const Aws::Utils::CryptoBuffer & GetGCMAAD() const
const Aws::Utils::CryptoBuffer & GetIV() const
void SetCekIV(const Aws::Utils::CryptoBuffer &iv)
void SetCEKGCMTag(const Aws::Utils::CryptoBuffer &tag)
const Aws::Utils::CryptoBuffer & GetFinalCEK() const
const Aws::Utils::CryptoBuffer & GetContentEncryptionKey() const
const Aws::Utils::CryptoBuffer & GetCekIV() const
void SetEncryptedContentEncryptionKey(const Aws::Utils::CryptoBuffer &encryptedContentEncryptionKey)
void SetContentCryptoScheme(ContentCryptoScheme contentCryptoScheme)
void SetContentEncryptionKey(const Aws::Utils::CryptoBuffer &contentEncryptionKey)
ContentCryptoMaterial(const Aws::Utils::CryptoBuffer &cek, ContentCryptoScheme contentCryptoScheme)
const Aws::Map< Aws::String, Aws::String > & GetMaterialsDescription() const
ContentCryptoMaterial(ContentCryptoScheme contentCryptoScheme)
ContentCryptoScheme GetContentCryptoScheme() const
void SetIV(const Aws::Utils::CryptoBuffer &iv)
void SetKeyWrapAlgorithm(KeyWrapAlgorithm keyWrapAlgorithm)
const Aws::Utils::CryptoBuffer & GetCEKGCMTag() const
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition AWSMap.h:20
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition AWSString.h:97