File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
main/java/software/amazon/encryption/s3
test/java/software/amazon/encryption/s3 Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 8282import java .util .Collections ;
8383import java .util .List ;
8484import java .util .Map ;
85- import java .util .Objects ;
8685import java .util .Optional ;
8786import java .util .concurrent .CompletableFuture ;
8887import java .util .concurrent .CompletionException ;
@@ -108,6 +107,7 @@ public class S3EncryptionClient extends DelegatingS3Client {
108107 // Used for request-scoped encryption contexts for supporting keys
109108 public static final ExecutionAttribute <Map <String , String >> ENCRYPTION_CONTEXT = new ExecutionAttribute <>("EncryptionContext" );
110109 public static final ExecutionAttribute <MultipartConfiguration > CONFIGURATION = new ExecutionAttribute <>("MultipartConfiguration" );
110+
111111 public static final ExecutionAttribute <String > CUSTOM_INSTRUCTION_FILE_SUFFIX = new ExecutionAttribute <>("CustomInstructionFileSuffix" );
112112
113113 private final S3Client _wrappedClient ;
Original file line number Diff line number Diff line change 22
33import org .junit .jupiter .api .BeforeAll ;
44import org .junit .jupiter .api .Test ;
5- import software .amazon .awssdk .core .Response ;
65import software .amazon .awssdk .core .ResponseBytes ;
76import software .amazon .awssdk .core .sync .RequestBody ;
87import software .amazon .awssdk .protocols .jsoncore .JsonNode ;
@@ -268,6 +267,16 @@ public void testRsaKeyringReEncryptInstructionFile() {
268267 assertEquals (clientEncryptedDataKeyAlgorithm , thirdPartyEncryptedDataKeyAlgorithm );
269268 assertNotEquals (clientEncryptedDataKey , thirdPartyEncryptedDataKey );
270269
270+ try {
271+ ResponseBytes <GetObjectResponse > thirdPartyDecryptObject = thirdPartyClient .getObjectAsBytes (builder -> builder
272+ .bucket (BUCKET )
273+ .key (objectKey )
274+ .build ());
275+ throw new RuntimeException ("Expected exception" );
276+ } catch (S3EncryptionClientException e ) {
277+ assertTrue (e .getMessage ().contains ("Unable to RSA-OAEP-SHA1 unwrap" ));
278+ }
279+
271280 ResponseBytes <GetObjectResponse > thirdPartyDecryptedObject = thirdPartyClient .getObjectAsBytes (builder -> builder
272281 .bucket (BUCKET )
273282 .key (objectKey )
@@ -285,5 +294,8 @@ public void testRsaKeyringReEncryptInstructionFile() {
285294 assertEquals (objectKey , reEncryptInstructionFileResponse .Key ());
286295 assertEquals (".third-party-access-instruction-file" , reEncryptInstructionFileResponse .InstructionFileSuffix ());
287296
297+ deleteObject (BUCKET , objectKey , client );
298+
288299 }
300+
289301}
You can’t perform that action at this time.
0 commit comments