Skip to content

Commit 790ae2b

Browse files
committed
remove exploratory tests in Compatibility tests class
1 parent 1287061 commit 790ae2b

File tree

1 file changed

+0
-213
lines changed

1 file changed

+0
-213
lines changed

src/test/java/software/amazon/encryption/s3/S3EncryptionClientCompatibilityTest.java

Lines changed: 0 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -276,219 +276,6 @@ public void AesGcmV3toV2() {
276276
deleteObject(BUCKET, objectKey, v3Client);
277277
v3Client.close();
278278
}
279-
@Test
280-
public void AesGcmV2toV3MatDescValidation() {
281-
final String objectKey = appendTestSuffix("aes-gcm-v2-to-v3-matdesc-validation");
282-
283-
// V2 Client
284-
EncryptionMaterials aesKeyOneMats = new EncryptionMaterials(AES_KEY);
285-
aesKeyOneMats.addDescription("key", "one-or-is-it???");
286-
SimpleMaterialProvider materialsProvider = new SimpleMaterialProvider();
287-
materialsProvider.addMaterial(aesKeyOneMats);
288-
// Encrypt with this one
289-
materialsProvider.withLatest(aesKeyOneMats);
290-
291-
AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder()
292-
.withEncryptionMaterialsProvider(materialsProvider)
293-
.build();
294-
295-
// V3 Client
296-
AesKeyring aesKeyring = AesKeyring.builder()
297-
.wrappingKey(AES_KEY)
298-
// Same key, different MatDesc
299-
.materialsDescription(MaterialsDescription.builder().put("key", "one").build())
300-
.build();
301-
S3Client v3Client = S3EncryptionClient.builder()
302-
.keyring(aesKeyring)
303-
.build();
304-
final String input = "AesGcmV3toV2";
305-
306-
// V2 encrypt, V3 decrypt
307-
v2Client.putObject(BUCKET, objectKey, input);
308-
ResponseBytes<GetObjectResponse> v3resp = v3Client.getObjectAsBytes(GetObjectRequest.builder()
309-
.bucket(BUCKET)
310-
.key(objectKey)
311-
.build());
312-
assertEquals(input, v3resp.asUtf8String());
313-
314-
// Cleanup
315-
deleteObject(BUCKET, objectKey, v3Client);
316-
v3Client.close();
317-
}
318-
319-
@Test
320-
public void AesGcmV2toV3MatDescValidationNoMatDesc() {
321-
final String objectKey = appendTestSuffix("aes-gcm-v2-to-v3-matdesc-validation-no-mat-desc");
322-
323-
// V2 Client
324-
EncryptionMaterials aesKeyOneMats = new EncryptionMaterials(AES_KEY);
325-
aesKeyOneMats.addDescription("key", "one-or-is-it???");
326-
SimpleMaterialProvider materialsProvider = new SimpleMaterialProvider();
327-
materialsProvider.addMaterial(aesKeyOneMats);
328-
// Encrypt with this one
329-
materialsProvider.withLatest(aesKeyOneMats);
330-
331-
AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder()
332-
.withEncryptionMaterialsProvider(materialsProvider)
333-
.build();
334-
335-
// V3 Client
336-
AesKeyring aesKeyring = AesKeyring.builder()
337-
.wrappingKey(AES_KEY)
338-
.build();
339-
S3Client v3Client = S3EncryptionClient.builder()
340-
.keyring(aesKeyring)
341-
.build();
342-
final String input = "AesGcmV3toV2";
343-
344-
// V2 encrypt, V3 decrypt
345-
v2Client.putObject(BUCKET, objectKey, input);
346-
ResponseBytes<GetObjectResponse> v3resp = v3Client.getObjectAsBytes(GetObjectRequest.builder()
347-
.bucket(BUCKET)
348-
.key(objectKey)
349-
.build());
350-
assertEquals(input, v3resp.asUtf8String());
351-
352-
// Cleanup
353-
deleteObject(BUCKET, objectKey, v3Client);
354-
v3Client.close();
355-
}
356-
357-
@Test
358-
public void AesGcmV3toV2MatDescValidation() {
359-
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v2-matdesc-validation");
360-
361-
// V2 Client
362-
EncryptionMaterials aesKeyOneMats = new EncryptionMaterials(AES_KEY);
363-
aesKeyOneMats.addDescription("key", "one-or-is-it???");
364-
SimpleMaterialProvider materialsProvider = new SimpleMaterialProvider();
365-
materialsProvider.addMaterial(aesKeyOneMats);
366-
// Encrypt with this one
367-
materialsProvider.withLatest(aesKeyOneMats);
368-
369-
AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder()
370-
.withEncryptionMaterialsProvider(materialsProvider)
371-
.build();
372-
373-
// V3 Client
374-
AesKeyring aesKeyring = AesKeyring.builder()
375-
.wrappingKey(AES_KEY)
376-
// Same key, different MatDesc
377-
.materialsDescription(MaterialsDescription.builder().put("key", "one").build())
378-
.build();
379-
S3Client v3Client = S3EncryptionClient.builder()
380-
.keyring(aesKeyring)
381-
.build();
382-
final String input = "AesGcmV2toV3";
383-
384-
// V3 encrypt, V2 decrypt
385-
v3Client.putObject(builder -> builder
386-
.bucket(BUCKET)
387-
.key(objectKey), RequestBody.fromString(input));
388-
389-
String output = v2Client.getObjectAsString(BUCKET, objectKey);
390-
assertEquals(input, output);
391-
392-
// Cleanup
393-
deleteObject(BUCKET, objectKey, v3Client);
394-
v3Client.close();
395-
}
396-
397-
398-
@Test
399-
public void AesGcmV3toV2MatDescValidationNoMatDesc() {
400-
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v2-matdesc-validation-no-mat-desc");
401-
402-
// V2 Client
403-
EncryptionMaterials aesKeyOneMats = new EncryptionMaterials(AES_KEY);
404-
aesKeyOneMats.addDescription("key", "one-or-is-it???");
405-
SimpleMaterialProvider materialsProvider = new SimpleMaterialProvider();
406-
materialsProvider.addMaterial(aesKeyOneMats);
407-
// Encrypt with this one
408-
materialsProvider.withLatest(aesKeyOneMats);
409-
410-
AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder()
411-
.withEncryptionMaterialsProvider(materialsProvider)
412-
.build();
413-
414-
// V3 Client
415-
AesKeyring aesKeyring = AesKeyring.builder()
416-
.wrappingKey(AES_KEY)
417-
.build();
418-
S3Client v3Client = S3EncryptionClient.builder()
419-
.keyring(aesKeyring)
420-
.build();
421-
final String input = "AesGcmV3toV2";
422-
v3Client.putObject(builder -> builder
423-
.bucket(BUCKET)
424-
.key(objectKey), RequestBody.fromString(input));
425-
426-
String output = v2Client.getObjectAsString(BUCKET, objectKey);
427-
assertEquals(input, output);
428-
429-
// Cleanup
430-
deleteObject(BUCKET, objectKey, v3Client);
431-
v3Client.close();
432-
}
433-
@Test
434-
public void AesGcmV3toV2ManyKeys() throws NoSuchAlgorithmException {
435-
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v2-many-keys");
436-
437-
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
438-
keyGen.init(256);
439-
SecretKey aesKeyTwo = keyGen.generateKey();
440-
SecretKey aesKeyThree = keyGen.generateKey();
441-
442-
// V2 Client
443-
EncryptionMaterials aesKeyOneMats = new EncryptionMaterials(AES_KEY);
444-
aesKeyOneMats.addDescription("key", "one-or-is-it???");
445-
// EncryptionMaterials aesKeyTwoMats = new EncryptionMaterials(aesKeyTwo);
446-
// aesKeyTwoMats.addDescription("key", "two");
447-
// EncryptionMaterials aesKeyThreeMats = new EncryptionMaterials(aesKeyThree);
448-
// aesKeyThreeMats.addDescription("key", "three");
449-
SimpleMaterialProvider materialsProvider = new SimpleMaterialProvider();
450-
materialsProvider.addMaterial(aesKeyOneMats);
451-
// materialsProvider.addMaterial(aesKeyTwoMats);
452-
// materialsProvider.addMaterial(aesKeyThreeMats);
453-
// Specify latest
454-
materialsProvider.withLatest(aesKeyOneMats);
455-
// materialsProvider.withLatest(aesKeyTwoMats);
456-
457-
AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder()
458-
.withEncryptionMaterialsProvider(materialsProvider)
459-
.build();
460-
461-
// V3 Client
462-
AesKeyring aesKeyring = AesKeyring.builder()
463-
.wrappingKey(AES_KEY)
464-
.materialsDescription(MaterialsDescription.builder().put("key", "one").build())
465-
.build();
466-
S3Client v3Client = S3EncryptionClient.builder()
467-
.keyring(aesKeyring)
468-
.build();
469-
final String input = "AesGcmV3toV2";
470-
471-
// V3 encrypt, V2 decrypt
472-
// v3Client.putObject(builder -> builder
473-
// .bucket(BUCKET)
474-
// .key(objectKey), RequestBody.fromString(input));
475-
//
476-
// String output = v2Client.getObjectAsString(BUCKET, objectKey);
477-
// assertEquals(input, output);
478-
479-
// V2 encrypt, V3 decrypt
480-
String objectKey2 = appendTestSuffix("v2-many-mats");
481-
v2Client.putObject(BUCKET, objectKey2, input);
482-
ResponseBytes<GetObjectResponse> v3resp = v3Client.getObjectAsBytes(GetObjectRequest.builder()
483-
.bucket(BUCKET)
484-
.key(objectKey2)
485-
.build());
486-
assertEquals(input, v3resp.asUtf8String());
487-
488-
// Cleanup
489-
deleteObject(BUCKET, objectKey, v3Client);
490-
v3Client.close();
491-
}
492279

493280
@Test
494281
public void AesGcmV3toV3() {

0 commit comments

Comments
 (0)