@@ -198,6 +198,43 @@ TEST_F(LiveClientTest, TestEOMode)
198198 AWS_EXPECT_SUCCESS (deleteResult);
199199}
200200
201+ TEST_F (LiveClientTest, TestEncryptionContextEmpty)
202+ {
203+ ClientConfiguration s3ClientConfig;
204+ s3ClientConfig.region = AWS_TEST_REGION;
205+
206+ auto key = SymmetricCipher::GenerateKey ();
207+ auto simpleEncryptionMaterials = Aws::MakeShared<Materials::SimpleEncryptionMaterialsWithGCMAAD>(ALLOCATION_TAG, key);
208+ CryptoConfigurationV2 configuration (simpleEncryptionMaterials);
209+
210+ static const char * objectKey = " TestEncryptionContextEmptyKey" ;
211+
212+ S3EncryptionClientV2 client (configuration, s3ClientConfig);
213+
214+ Model::PutObjectRequest putObjectRequest;
215+ putObjectRequest.WithBucket (BucketName.c_str ())
216+ .WithKey (objectKey);
217+
218+ auto ss = Aws::MakeShared<Aws::StringStream>(ALLOCATION_TAG);
219+ *ss << TEST_STRING;
220+ ss->flush ();
221+
222+ putObjectRequest.SetBody (ss);
223+
224+ auto putObjectResult = client.PutObject (putObjectRequest, {});
225+ AWS_ASSERT_SUCCESS (putObjectResult);
226+
227+ Model::GetObjectRequest getObjectRequest;
228+ getObjectRequest.WithBucket (BucketName.c_str ()).WithKey (objectKey);
229+
230+ auto getObjectResult = client.GetObject (getObjectRequest);
231+ AWS_EXPECT_SUCCESS (getObjectResult);
232+ getObjectResult = client.GetObject (getObjectRequest, {});
233+ AWS_EXPECT_SUCCESS (getObjectResult);
234+ getObjectResult = client.GetObject (getObjectRequest, {{" foo" , " bar" }});
235+ EXPECT_FALSE (getObjectResult.IsSuccess ());
236+ }
237+
201238TEST_F (LiveClientTest, TestAEMode)
202239{
203240 CryptoConfiguration configuration;
0 commit comments