11package software .amazon .encryption .s3 .examples ;
22
33import org .apache .commons .io .IOUtils ;
4+ import org .bouncycastle .jce .provider .BouncyCastleProvider ;
45import software .amazon .awssdk .core .ResponseInputStream ;
56import software .amazon .awssdk .core .sync .RequestBody ;
67import software .amazon .awssdk .services .s3 .S3Client ;
1718import java .io .ByteArrayOutputStream ;
1819import java .io .IOException ;
1920import java .io .InputStream ;
21+ import java .security .Provider ;
22+ import java .security .Security ;
2023import java .util .ArrayList ;
2124import java .util .HashMap ;
2225import java .util .List ;
@@ -52,6 +55,9 @@ public static void LowLevelMultipartUpload() throws IOException {
5255 final InputStream inputStream = new BoundedInputStream (fileSizeLimit );
5356 final InputStream objectStreamForResult = new BoundedInputStream (fileSizeLimit );
5457
58+ Security .addProvider (new BouncyCastleProvider ());
59+ Provider PROVIDER = Security .getProvider ("BC" );
60+
5561 // Instantiate the S3 Encryption Client to encrypt and decrypt
5662 // by specifying a KMS Key with the kmsKeyId builder parameter.
5763 // enable `enableDelayedAuthenticationMode` parameter to download more than 64MB object or
@@ -62,6 +68,7 @@ public static void LowLevelMultipartUpload() throws IOException {
6268 S3Client v3Client = S3EncryptionClient .builder ()
6369 .kmsKeyId (KMS_KEY_ID )
6470 .enableDelayedAuthenticationMode (true )
71+ .cryptoProvider (PROVIDER )
6572 .build ();
6673
6774 // Create Multipart upload request to S3
0 commit comments