-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessresponse-requestedWaiting on additional info or feedback. Will move to "closing-soon" in 5 days.Waiting on additional info or feedback. Will move to "closing-soon" in 5 days.
Description
Describe the bug
I am attempting to use AmazonS3EncryptionV2 for client side S3 encryption and getting the below runtime error. I am following the documenting in the development guide.
A more recent version of Bouncy castle is required for authenticated encryption
Expected Behavior
Using the latest AWS and Bouncy Castle libraries should work based on error and documentation.
Current Behavior
Runtime error:
A more recent version of Bouncy castle is required for authenticated encryption
Steps to Reproduce
Exception in thread "main" java.lang.UnsupportedOperationException: A more recent version of Bouncy castle is required for authenticated encryption.
at com.amazonaws.services.s3.model.CryptoConfigurationV2.checkBountyCastle(CryptoConfigurationV2.java:379)
at com.amazonaws.services.s3.model.CryptoConfigurationV2.checkCryptoMode(CryptoConfigurationV2.java:366)
at com.amazonaws.services.s3.model.CryptoConfigurationV2.<init>(CryptoConfigurationV2.java:68)
at com.amazonaws.services.s3.model.CryptoConfigurationV2.<init>(CryptoConfigurationV2.java:47)
at securities.CryptoUtil.Encrypt(CryptoUtil.java:41)
at securities.App.main(App.java:19)
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(2048);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
String s3ObjectKey = "test.txt";
String s3ObjectContent = "This should be encrypt";
AmazonS3EncryptionV2 s3EncryptionClientV2 = AmazonS3EncryptionClientV2Builder.standard()
.withRegion(Regions.DEFAULT_REGION)
.withClientConfiguration(new ClientConfiguration())
.withCryptoConfiguration(new CryptoConfigurationV2().withCryptoMode(CryptoMode.AuthenticatedEncryption))
.withEncryptionMaterialsProvider(new StaticEncryptionMaterialsProvider(new EncryptionMaterials(keyPair)))
.build();
s3EncryptionClientV2.putObject(bucketName, s3ObjectKey, s3ObjectContent);
s3EncryptionClientV2.shutdown();
return s3EncryptionClientV2.getObjectAsString(bucketName, s3ObjectKey);
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.877</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-kms</artifactId>
<version>1.11.877</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.877</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-ext-jdk15on</artifactId>
<version>1.66</version>
</dependency>
</dependencies>
Possible Solution
Context
Unable to use latest Java Client side encryption SDK.
Your Environment
- AWS Java SDK version used: 1.11.877
- JDK version used: 14
- Operating System and version: Mac 10.15.7
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessresponse-requestedWaiting on additional info or feedback. Will move to "closing-soon" in 5 days.Waiting on additional info or feedback. Will move to "closing-soon" in 5 days.