Skip to content

Commit d45c026

Browse files
author
Anirav Kareddy
committed
Added test cases to test legacy wrapping algorithm upgrades + backwards compatability
1 parent 4164acf commit d45c026

File tree

2 files changed

+738
-2
lines changed

2 files changed

+738
-2
lines changed

src/main/java/software/amazon/encryption/s3/S3EncryptionClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import java.security.Provider;
8080
import java.security.SecureRandom;
8181
import java.util.ArrayList;
82+
import java.util.Arrays;
8283
import java.util.Collections;
8384
import java.util.List;
8485
import java.util.Map;
@@ -200,14 +201,14 @@ public ReEncryptInstructionFileResponse reEncryptInstructionFile(ReEncryptInstru
200201
ContentMetadata contentMetadata = decodingStrategy.decode(request, response.response());
201202

202203
AlgorithmSuite algorithmSuite = contentMetadata.algorithmSuite();
203-
EncryptedDataKey encryptedDataKey = contentMetadata.encryptedDataKey();
204+
EncryptedDataKey originalEncryptedDataKeys = contentMetadata.encryptedDataKey();
204205
Map<String, String> currentKeyringMaterialsDescription = contentMetadata.encryptedDataKeyContext();
205206
byte[] iv = contentMetadata.contentIv();
206207

207208
DecryptionMaterials decryptedMaterials = this._cryptoMaterialsManager.decryptMaterials(
208209
DecryptMaterialsRequest.builder()
209210
.algorithmSuite(algorithmSuite)
210-
.encryptedDataKeys(Collections.singletonList(encryptedDataKey))
211+
.encryptedDataKeys(Collections.singletonList(originalEncryptedDataKeys))
211212
.s3Request(request)
212213
.build()
213214
);

0 commit comments

Comments
 (0)