AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
CryptoConfiguration.h
1
5#pragma once
6
7#include <aws/s3-encryption/s3Encryption_EXPORTS.h>
8#include <aws/s3-encryption/materials/KMSEncryptionMaterials.h>
9#include <aws/s3-encryption/materials/SimpleEncryptionMaterials.h>
10namespace Aws
11{
12 namespace S3Encryption
13 {
15
16 enum class StorageMethod
17 {
20 };
21
22 enum class CryptoMode
23 {
24 /*
25 * Encrypt with a non-authenticated mode of operation.
26 *
27 * NOTE: This feature is in maintenance mode, no new updates will be released.
28 * Please see https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html for more information.
29 */
31 /*
32 * Encrypt with an authenticated mode of operation, but do not require that objects be authenticated on Get.
33 *
34 * NOTE: This feature is in maintenance mode, no new updates will be released.
35 * Please see https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html for more information.
36 */
38 /*
39 * Encrypt and decrypt with an authenticated mode of operation only.
40 */
42 };
43
44 enum class SecurityProfile
45 {
46 V2, // Client only decrypt objects encrypted using best practice key wrap algorithms (KMS_CONTEXT and AES_GCM ) and best practice content crypto schemes (AES_GCM)
47 V2_AND_LEGACY, // Client will try to decrypt objects encrypted using all key wrap algorithms (KMS_CONTEXT, KMS, AES_KeyWrap, AES_GCM) and content crypto schemes (AES_GCM, AES_CBC).
48 };
49
50 enum class RangeGetMode
51 {
52 DISABLED, // Range get is not allowed
53 ALL, // Range get is allowed
54 };
55
56 class AWS_S3ENCRYPTION_API CryptoConfiguration
57 {
58 public:
59 /*
60 * Default constructor.
61 */
63
64 /*
65 * Constructor that accepts a storage method and defaults the cryptoMode to authenticated encryption.
66 */
68
69 /*
70 * Constructor that accepts a crypto mode and defaults the storage method to metadata.
71 */
73
74 /*
75 * Constructor that accepts storage method and crypto mode. Default storage method is metadata and default crypto mode is authenticated encryption.
76 */
78
83 {
84 return m_storageMethod;
85 }
86
91 {
92 return m_cryptoMode;
93 }
94
98 inline void SetStorageMethod(StorageMethod storageMethod)
99 {
100 m_storageMethod = storageMethod;
101 }
102
106 inline void SetCryptoMode(CryptoMode cryptoMode)
107 {
108 m_cryptoMode = cryptoMode;
109 }
110
111 private:
112 inline void SetSecurityProfile(SecurityProfile profile) { m_securityProfile = profile; }
113 inline void SetUnAuthenticatedRangeGet(RangeGetMode mode) { m_unAuthenticatedRangeGet = mode; }
114 inline RangeGetMode GetUnAuthenticatedRangeGet() const { return m_unAuthenticatedRangeGet; }
115 inline SecurityProfile GetSecurityProfile() const { return m_securityProfile; }
116
117 StorageMethod m_storageMethod;
118 CryptoMode m_cryptoMode;
119 RangeGetMode m_unAuthenticatedRangeGet;
120 SecurityProfile m_securityProfile;
121
124 };
125
126 class AWS_S3ENCRYPTION_API CryptoConfigurationV2
127 {
128 public:
129 CryptoConfigurationV2(const std::shared_ptr<Aws::S3Encryption::Materials::KMSWithContextEncryptionMaterials>& materials);
130 CryptoConfigurationV2(const std::shared_ptr<Aws::S3Encryption::Materials::SimpleEncryptionMaterialsWithGCMAAD>& materials);
131
132 inline void SetSecurityProfile(SecurityProfile profile) { m_securityProfile = profile; }
133 inline void SetUnAuthenticatedRangeGet(RangeGetMode mode) { m_unAuthenticatedRangeGet = mode; }
134 inline void SetStorageMethod(StorageMethod storageMethod) { m_storageMethod = storageMethod; }
135
136 inline SecurityProfile GetSecurityProfile() const { return m_securityProfile; }
137 inline RangeGetMode GetUnAuthenticatedRangeGet() const { return m_unAuthenticatedRangeGet; }
138 inline StorageMethod GetStorageMethod() const { return m_storageMethod; }
139 std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials> GetEncryptionMaterials() const { return m_encryptionMaterials; }
140
141 private:
142 StorageMethod m_storageMethod;
143 RangeGetMode m_unAuthenticatedRangeGet;
144 SecurityProfile m_securityProfile;
145 std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials> m_encryptionMaterials;
146 };
147 }
148}
CryptoConfiguration(StorageMethod storageMethod)
void SetCryptoMode(CryptoMode cryptoMode)
CryptoConfiguration(CryptoMode cryptoMode)
CryptoConfiguration(StorageMethod storageMode, CryptoMode cryptoMode)
void SetStorageMethod(StorageMethod storageMethod)
std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > GetEncryptionMaterials() const
void SetStorageMethod(StorageMethod storageMethod)
CryptoConfigurationV2(const std::shared_ptr< Aws::S3Encryption::Materials::SimpleEncryptionMaterialsWithGCMAAD > &materials)
void SetSecurityProfile(SecurityProfile profile)
CryptoConfigurationV2(const std::shared_ptr< Aws::S3Encryption::Materials::KMSWithContextEncryptionMaterials > &materials)