1
1
package software .amazon .encryption .s3 ;
2
2
3
- import static org .junit .jupiter .api .Assertions .assertEquals ;
4
- import static org .junit .jupiter .api .Assertions .assertThrows ;
5
- import static software .amazon .encryption .s3 .S3EncryptionClient .withAdditionalConfiguration ;
6
- import static software .amazon .encryption .s3 .utils .S3EncryptionClientTestResources .deleteObject ;
7
-
8
3
import com .amazonaws .regions .Region ;
9
4
import com .amazonaws .regions .Regions ;
10
5
import com .amazonaws .services .s3 .AmazonS3Encryption ;
21
16
import com .amazonaws .services .s3 .model .KMSEncryptionMaterials ;
22
17
import com .amazonaws .services .s3 .model .KMSEncryptionMaterialsProvider ;
23
18
import com .amazonaws .services .s3 .model .StaticEncryptionMaterialsProvider ;
19
+ import org .junit .jupiter .api .BeforeAll ;
20
+ import org .junit .jupiter .api .Test ;
21
+ import software .amazon .awssdk .core .ResponseBytes ;
22
+ import software .amazon .awssdk .core .sync .RequestBody ;
23
+ import software .amazon .awssdk .services .s3 .S3Client ;
24
+ import software .amazon .awssdk .services .s3 .model .GetObjectRequest ;
25
+ import software .amazon .awssdk .services .s3 .model .GetObjectResponse ;
26
+ import software .amazon .awssdk .services .s3 .model .PutObjectRequest ;
24
27
28
+ import javax .crypto .KeyGenerator ;
29
+ import javax .crypto .SecretKey ;
25
30
import java .io .ByteArrayInputStream ;
26
31
import java .io .IOException ;
27
32
import java .nio .charset .StandardCharsets ;
30
35
import java .security .NoSuchAlgorithmException ;
31
36
import java .util .HashMap ;
32
37
import java .util .Map ;
33
- import javax .crypto .KeyGenerator ;
34
- import javax .crypto .SecretKey ;
35
38
36
- import org .junit .jupiter .api .BeforeAll ;
37
- import org .junit .jupiter .api .Test ;
38
- import software .amazon .awssdk .core .ResponseBytes ;
39
- import software .amazon .awssdk .core .sync .RequestBody ;
40
- import software .amazon .awssdk .services .s3 .S3Client ;
41
- import software .amazon .awssdk .services .s3 .model .GetObjectRequest ;
42
- import software .amazon .awssdk .services .s3 .model .GetObjectResponse ;
43
- import software .amazon .awssdk .services .s3 .model .PutObjectRequest ;
39
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
40
+ import static org .junit .jupiter .api .Assertions .assertThrows ;
41
+ import static software .amazon .encryption .s3 .S3EncryptionClient .withAdditionalConfiguration ;
42
+ import static software .amazon .encryption .s3 .utils .S3EncryptionClientTestResources .appendTestSuffix ;
43
+ import static software .amazon .encryption .s3 .utils .S3EncryptionClientTestResources .deleteObject ;
44
44
45
45
/**
46
46
* This class is an integration test for verifying compatibility of ciphertexts
@@ -68,7 +68,7 @@ public static void setUp() throws NoSuchAlgorithmException {
68
68
69
69
@ Test
70
70
public void AesCbcV1toV3 () {
71
- final String objectKey = "aes-cbc-v1-to-v3" ;
71
+ final String objectKey = appendTestSuffix ( "aes-cbc-v1-to-v3" ) ;
72
72
73
73
// V1 Client
74
74
EncryptionMaterialsProvider materialsProvider =
@@ -103,7 +103,7 @@ public void AesCbcV1toV3() {
103
103
104
104
@ Test
105
105
public void AesWrapV1toV3 () {
106
- final String objectKey = "aes-wrap-v1-to-v3" ;
106
+ final String objectKey = appendTestSuffix ( "aes-wrap-v1-to-v3" ) ;
107
107
108
108
// V1 Client
109
109
EncryptionMaterialsProvider materialsProvider =
@@ -138,7 +138,7 @@ public void AesWrapV1toV3() {
138
138
139
139
@ Test
140
140
public void AesGcmV2toV3 () {
141
- final String objectKey = "aes-gcm-v2-to-v3" ;
141
+ final String objectKey = appendTestSuffix ( "aes-gcm-v2-to-v3" ) ;
142
142
143
143
// V2 Client
144
144
EncryptionMaterialsProvider materialsProvider =
@@ -169,7 +169,7 @@ public void AesGcmV2toV3() {
169
169
170
170
@ Test
171
171
public void AesGcmV2toV3WithInstructionFile () {
172
- final String objectKey = "aes-gcm-v2-to-v3-with-instruction-file" ;
172
+ final String objectKey = appendTestSuffix ( "aes-gcm-v2-to-v3-with-instruction-file" ) ;
173
173
174
174
// V2 Client
175
175
EncryptionMaterialsProvider materialsProvider =
@@ -205,7 +205,7 @@ public void AesGcmV2toV3WithInstructionFile() {
205
205
206
206
@ Test
207
207
public void AesGcmV3toV1 () {
208
- final String objectKey = "aes-gcm-v3-to-v1" ;
208
+ final String objectKey = appendTestSuffix ( "aes-gcm-v3-to-v1" ) ;
209
209
210
210
// V1 Client
211
211
EncryptionMaterialsProvider materialsProvider =
@@ -238,7 +238,7 @@ public void AesGcmV3toV1() {
238
238
239
239
@ Test
240
240
public void AesGcmV3toV2 () {
241
- final String objectKey = "aes-gcm-v3-to-v2" ;
241
+ final String objectKey = appendTestSuffix ( "aes-gcm-v3-to-v2" ) ;
242
242
243
243
// V2 Client
244
244
EncryptionMaterialsProvider materialsProvider =
@@ -268,7 +268,7 @@ public void AesGcmV3toV2() {
268
268
269
269
@ Test
270
270
public void AesGcmV3toV3 () {
271
- final String objectKey = "aes-gcm-v3-to-v3" ;
271
+ final String objectKey = appendTestSuffix ( "aes-gcm-v3-to-v3" ) ;
272
272
273
273
// V3 Client
274
274
S3Client v3Client = S3EncryptionClient .builder ()
@@ -295,7 +295,7 @@ public void AesGcmV3toV3() {
295
295
296
296
@ Test
297
297
public void RsaEcbV1toV3 () {
298
- final String objectKey = "rsa-ecb-v1-to-v3" ;
298
+ final String objectKey = appendTestSuffix ( "rsa-ecb-v1-to-v3" ) ;
299
299
300
300
// V1 Client
301
301
EncryptionMaterialsProvider materialsProvider =
@@ -330,7 +330,7 @@ public void RsaEcbV1toV3() {
330
330
331
331
@ Test
332
332
public void RsaOaepV2toV3 () {
333
- final String objectKey = "rsa-oaep-v2-to-v3" ;
333
+ final String objectKey = appendTestSuffix ( "rsa-oaep-v2-to-v3" ) ;
334
334
335
335
// V2 Client
336
336
EncryptionMaterialsProvider materialsProvider =
@@ -364,7 +364,7 @@ public void RsaOaepV2toV3() {
364
364
365
365
@ Test
366
366
public void RsaOaepV3toV1 () {
367
- final String objectKey = "rsa-oaep-v3-to-v1" ;
367
+ final String objectKey = appendTestSuffix ( "rsa-oaep-v3-to-v1" ) ;
368
368
369
369
// V1 Client
370
370
EncryptionMaterialsProvider materialsProvider =
@@ -397,7 +397,7 @@ public void RsaOaepV3toV1() {
397
397
398
398
@ Test
399
399
public void RsaOaepV3toV2 () {
400
- final String objectKey = "rsa-oaep-v3-to-v2" ;
400
+ final String objectKey = appendTestSuffix ( "rsa-oaep-v3-to-v2" ) ;
401
401
402
402
// V2 Client
403
403
EncryptionMaterialsProvider materialsProvider =
@@ -427,7 +427,7 @@ public void RsaOaepV3toV2() {
427
427
428
428
@ Test
429
429
public void RsaOaepV3toV3 () {
430
- final String objectKey = "rsa-oaep-v3-to-v3" ;
430
+ final String objectKey = appendTestSuffix ( "rsa-oaep-v3-to-v3" ) ;
431
431
432
432
// V3 Client
433
433
S3Client v3Client = S3EncryptionClient .builder ()
@@ -454,7 +454,7 @@ public void RsaOaepV3toV3() {
454
454
455
455
@ Test
456
456
public void KmsV1toV3 () {
457
- final String objectKey = "kms-v1-to-v3" ;
457
+ final String objectKey = appendTestSuffix ( "kms-v1-to-v3" ) ;
458
458
459
459
// V1 Client
460
460
EncryptionMaterialsProvider materialsProvider = new KMSEncryptionMaterialsProvider (KMS_KEY_ID );
@@ -491,7 +491,7 @@ public void KmsV1toV3() {
491
491
492
492
@ Test
493
493
public void KmsContextV2toV3 () {
494
- final String objectKey = "kms-context-v2-to-v3" ;
494
+ final String objectKey = appendTestSuffix ( "kms-context-v2-to-v3" ) ;
495
495
496
496
// V2 Client
497
497
EncryptionMaterialsProvider materialsProvider = new KMSEncryptionMaterialsProvider (KMS_KEY_ID );
@@ -532,7 +532,7 @@ public void KmsContextV2toV3() {
532
532
533
533
@ Test
534
534
public void KmsContextV3toV1 () {
535
- final String objectKey = "kms-context-v3-to-v1" ;
535
+ final String objectKey = appendTestSuffix ( "kms-context-v3-to-v1" ) ;
536
536
537
537
// V1 Client
538
538
KMSEncryptionMaterials kmsMaterials = new KMSEncryptionMaterials (KMS_KEY_ID );
@@ -574,7 +574,7 @@ public void KmsContextV3toV1() {
574
574
575
575
@ Test
576
576
public void KmsContextV3toV2 () throws IOException {
577
- final String objectKey = "kms-context-v3-to-v2" ;
577
+ final String objectKey = appendTestSuffix ( "kms-context-v3-to-v2" ) ;
578
578
579
579
// V2 Client
580
580
KMSEncryptionMaterials kmsMaterials = new KMSEncryptionMaterials (KMS_KEY_ID );
@@ -612,7 +612,7 @@ public void KmsContextV3toV2() throws IOException {
612
612
613
613
@ Test
614
614
public void KmsContextV3toV3 () {
615
- final String objectKey = "kms-context-v3-to-v3" ;
615
+ final String objectKey = appendTestSuffix ( "kms-context-v3-to-v3" ) ;
616
616
617
617
// V3 Client
618
618
S3Client v3Client = S3EncryptionClient .builder ()
@@ -646,7 +646,7 @@ public void KmsContextV3toV3() {
646
646
647
647
@ Test
648
648
public void AesCbcV1toV3FailsWhenLegacyModeDisabled () {
649
- final String objectKey = "aes-cbc-v1-to-v3" ;
649
+ final String objectKey = appendTestSuffix ( "aes-cbc-v1-to-v3" ) ;
650
650
651
651
EncryptionMaterialsProvider materialsProvider =
652
652
new StaticEncryptionMaterialsProvider (new EncryptionMaterials (AES_KEY ));
@@ -676,7 +676,7 @@ public void AesCbcV1toV3FailsWhenLegacyModeDisabled() {
676
676
677
677
@ Test
678
678
public void AesWrapV1toV3FailsWhenLegacyModeDisabled () {
679
- final String objectKey = "aes-wrap-v1-to-v3" ;
679
+ final String objectKey = appendTestSuffix ( "aes-wrap-v1-to-v3" ) ;
680
680
681
681
EncryptionMaterialsProvider materialsProvider =
682
682
new StaticEncryptionMaterialsProvider (new EncryptionMaterials (AES_KEY ));
0 commit comments