AWS SDK for C++  1.9.132
AWS SDK for C++
ContentCryptoMaterial.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <aws/core/Aws.h>
12 
13 namespace Aws
14 {
15  namespace Utils
16  {
17  namespace Crypto
18  {
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  }
176  inline const Aws::Utils::CryptoBuffer& GetGCMAAD() const
177  {
178  return m_gcmAAD;
179  }
180 
184  inline void SetCEKGCMTag(const Aws::Utils::CryptoBuffer& tag)
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  }
221  inline const Aws::Utils::CryptoBuffer& GetFinalCEK() const
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;
234  Aws::Utils::CryptoBuffer m_cekIV;
235  Aws::Utils::CryptoBuffer m_gcmAAD;
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 }
Aws::Utils::Crypto::ContentCryptoMaterial::SetMaterialsDescription
void SetMaterialsDescription(const Aws::Map< Aws::String, Aws::String > &materialsDescription)
Definition: ContentCryptoMaterial.h:145
Aws::Utils::Crypto::ContentCryptoMaterial::ContentCryptoMaterial
ContentCryptoMaterial(ContentCryptoScheme contentCryptoScheme)
AWS_CORE_API
#define AWS_CORE_API
Definition: Core_EXPORTS.h:25
Aws::Utils::Crypto::ContentCryptoMaterial::GetEncryptedContentEncryptionKey
const Aws::Utils::CryptoBuffer & GetEncryptedContentEncryptionKey() const
Definition: ContentCryptoMaterial.h:49
Aws::Utils::Crypto::ContentCryptoMaterial::ContentCryptoMaterial
ContentCryptoMaterial(const Aws::Utils::CryptoBuffer &cek, ContentCryptoScheme contentCryptoScheme)
Aws::Utils::Crypto::ContentCryptoMaterial::SetCryptoTagLength
void SetCryptoTagLength(size_t cryptoTagLength)
Definition: ContentCryptoMaterial.h:129
Aws::Utils::Crypto::ContentCryptoMaterial::GetContentCryptoScheme
ContentCryptoScheme GetContentCryptoScheme() const
Definition: ContentCryptoMaterial.h:97
Aws::Utils::Crypto::ContentCryptoMaterial
Definition: ContentCryptoMaterial.h:20
Aws::Utils::Crypto::ContentCryptoMaterial::GetMaterialsDescription
const Aws::Map< Aws::String, Aws::String > & GetMaterialsDescription() const
Definition: ContentCryptoMaterial.h:73
Aws::Utils::Crypto::KeyWrapAlgorithm
KeyWrapAlgorithm
Definition: KeyWrapAlgorithm.h:16
KeyWrapAlgorithm.h
Aws::Utils::Crypto::ContentCryptoMaterial::SetKeyWrapAlgorithm
void SetKeyWrapAlgorithm(KeyWrapAlgorithm keyWrapAlgorithm)
Definition: ContentCryptoMaterial.h:153
Aws::Utils::Crypto::ContentCryptoMaterial::GetCekIV
const Aws::Utils::CryptoBuffer & GetCekIV() const
Definition: ContentCryptoMaterial.h:206
Aws::Utils::Crypto::ContentCryptoMaterial::GetFinalCEK
const Aws::Utils::CryptoBuffer & GetFinalCEK() const
Definition: ContentCryptoMaterial.h:221
Aws::Utils::Crypto::ContentCryptoMaterial::GetMaterialsDescription
const Aws::String & GetMaterialsDescription(const Aws::String &key) const
Definition: ContentCryptoMaterial.h:81
ContentCryptoScheme.h
Aws::Utils::Crypto::ContentCryptoMaterial::GetKeyWrapAlgorithm
KeyWrapAlgorithm GetKeyWrapAlgorithm() const
Definition: ContentCryptoMaterial.h:89
Aws::Utils::Crypto::ContentCryptoMaterial::GetContentEncryptionKey
const Aws::Utils::CryptoBuffer & GetContentEncryptionKey() const
Definition: ContentCryptoMaterial.h:41
Aws::Utils::Crypto::ContentCryptoMaterial::SetContentCryptoScheme
void SetContentCryptoScheme(ContentCryptoScheme contentCryptoScheme)
Definition: ContentCryptoMaterial.h:161
Aws::Utils::Crypto::ContentCryptoMaterial::SetIV
void SetIV(const Aws::Utils::CryptoBuffer &iv)
Definition: ContentCryptoMaterial.h:121
Aws::Utils::Crypto::ContentCryptoMaterial::SetGCMAAD
void SetGCMAAD(const Aws::Utils::CryptoBuffer &aad)
Definition: ContentCryptoMaterial.h:169
Aws::Utils::Crypto::ContentCryptoMaterial::SetCEKGCMTag
void SetCEKGCMTag(const Aws::Utils::CryptoBuffer &tag)
Definition: ContentCryptoMaterial.h:184
Aws.h
Core_EXPORTS.h
Aws::Utils::CryptoBuffer
Definition: Array.h:229
Aws::Utils::Crypto::ContentCryptoMaterial::GetCryptoTagLength
size_t GetCryptoTagLength() const
Definition: ContentCryptoMaterial.h:65
Aws
Definition: AccessManagementClient.h:15
Aws::Utils::Crypto::ContentCryptoMaterial::GetIV
const Aws::Utils::CryptoBuffer & GetIV() const
Definition: ContentCryptoMaterial.h:57
Aws::Utils::Crypto::ContentCryptoMaterial::GetGCMAAD
const Aws::Utils::CryptoBuffer & GetGCMAAD() const
Definition: ContentCryptoMaterial.h:176
Aws::Utils::Crypto::ContentCryptoMaterial::ContentCryptoMaterial
ContentCryptoMaterial()
Aws::Utils::Crypto::ContentCryptoMaterial::SetContentEncryptionKey
void SetContentEncryptionKey(const Aws::Utils::CryptoBuffer &contentEncryptionKey)
Definition: ContentCryptoMaterial.h:105
Aws::String
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
Aws::Utils::Crypto::ContentCryptoMaterial::AddMaterialsDescription
void AddMaterialsDescription(const Aws::String &key, const Aws::String &value)
Definition: ContentCryptoMaterial.h:137
Aws::Utils::Crypto::ContentCryptoMaterial::SetFinalCEK
void SetFinalCEK(const Aws::Utils::CryptoBuffer &finalCEK)
Definition: ContentCryptoMaterial.h:214
CryptoBuf.h
Aws::Utils::Crypto::ContentCryptoMaterial::GetCEKGCMTag
const Aws::Utils::CryptoBuffer & GetCEKGCMTag() const
Definition: ContentCryptoMaterial.h:191
Aws::Utils::Crypto::ContentCryptoMaterial::SetCekIV
void SetCekIV(const Aws::Utils::CryptoBuffer &iv)
Definition: ContentCryptoMaterial.h:199
Aws::Utils::Crypto::ContentCryptoMaterial::SetEncryptedContentEncryptionKey
void SetEncryptedContentEncryptionKey(const Aws::Utils::CryptoBuffer &encryptedContentEncryptionKey)
Definition: ContentCryptoMaterial.h:113
Aws::Map
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition: AWSMap.h:19
Aws::Utils::Crypto::ContentCryptoScheme
ContentCryptoScheme
Definition: ContentCryptoScheme.h:16