public async Task PutGetTemperedCekAlgUsingMetadataMode() { // Put encrypted content var key = await PutContentAsync(s3EncryptionClientMetadataModeAsymmetricWrap, null, null, sampleContent, sampleContent, bucketName).ConfigureAwait(false); // Temper the cek algorithm await TemperCekAlgAsync(s3Client, bucketName, key); // Verify AssertExtensions.ExpectException <InvalidDataException>(() => { AsyncHelpers.RunSync(() => EncryptionTestsUtils.TestGetAsync(key, sampleContent, s3EncryptionClientMetadataModeAsymmetricWrap, bucketName)); }); }
public async Task PutGetTemperedContentUsingMetadataMode() { // Put encrypted content var key = await PutContentAsync(s3EncryptionClientMetadataModeAsymmetricWrap, null, null, sampleContent, sampleContent, bucketName).ConfigureAwait(false); // Temper the content await TemperCipherTextAsync(s3Client, bucketName, key); // Verify AssertExtensions.ExpectException <AmazonCryptoException>( () => { AsyncHelpers.RunSync(() => EncryptionTestsUtils.TestGetAsync(key, sampleContent, s3EncryptionClientMetadataModeAsymmetricWrap, bucketName)); }, "Failed to decrypt: mac check in GCM failed"); }