This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit aa60b4f8a00dc0b743a01772afe2fa171580229e
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Fri Dec 4 13:37:42 2026 +0100

    camel-aws2-s3: allow SSE-C on the buckets of S3CopyObjectCustomerKeyIT and 
document that S3 blocks it by default
    
    Amazon S3 blocks SSE-C by default on the general purpose buckets created 
since
    April 2026 and rejects the uploads with a 403 AccessDenied. Floci 2.6.0 
emulates
    it, which makes S3CopyObjectCustomerKeyIT fail (apache/camel#31343).
    
    - the IT unblocks SSE-C on its buckets with PutBucketEncryption and
      BlockedEncryptionTypes=NONE
    - the useCustomerKey option and the component documentation mention the 
block
    
    Co-authored-by: IBM Bob <[email protected]>
---
 .../apache/camel/catalog/components/aws2-s3.json   |  4 +--
 .../camel/catalog/docs/aws2-s3-component.adoc      |  5 ++++
 .../apache/camel/component/aws2/s3/aws2-s3.json    |  4 +--
 .../src/main/docs/aws2-s3-component.adoc           |  5 ++++
 .../component/aws2/s3/AWS2S3Configuration.java     |  5 +++-
 .../s3/integration/S3CopyObjectCustomerKeyIT.java  | 29 ++++++++++++++++++++++
 6 files changed, 47 insertions(+), 5 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
index e3e96b170d18..4a067b270c08 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-s3.json
@@ -38,7 +38,7 @@
     "customerAlgorithm": { "index": 11, "kind": "property", "displayName": 
"Customer Algorithm", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The encryption algorithm of SSE-C, used when 
useCustomerKey is true. S3 sup [...]
     "customerKeyId": { "index": 12, "kind": "property", "displayName": 
"Customer Key Id", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The customer-provided key of SSE-C, used when 
useCustomerKey is true: the 256-bit  [...]
     "customerKeyMD5": { "index": 13, "kind": "property", "displayName": 
"Customer Key MD5", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The base64-encoded 128-bit MD5 digest of the 
customer-provided key of customerKe [...]
-    "useCustomerKey": { "index": 14, "kind": "property", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided ke [...]
+    "useCustomerKey": { "index": 14, "kind": "property", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided ke [...]
     "bridgeErrorHandler": { "index": 15, "kind": "property", "displayName": 
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Allows for bridging the consumer to the Camel routing Error Handler, which 
mean any exceptions (if possible) occurred while the Camel consumer is trying 
to pickup incoming messages, or the lik [...]
     "deleteAfterRead": { "index": 16, "kind": "property", "displayName": 
"Delete After Read", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to delete each 
consumed object from the bucket after its exchange comple [...]
     "destinationBucket": { "index": 17, "kind": "property", "displayName": 
"Destination Bucket", "group": "consumer", "label": "consumer", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The bucket that moveAfterRead copies the 
consumed objects to. The consumer checks at startu [...]
@@ -169,7 +169,7 @@
     "customerAlgorithm": { "index": 11, "kind": "parameter", "displayName": 
"Customer Algorithm", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The encryption algorithm of SSE-C, used when 
useCustomerKey is true. S3 su [...]
     "customerKeyId": { "index": 12, "kind": "parameter", "displayName": 
"Customer Key Id", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The customer-provided key of SSE-C, used when 
useCustomerKey is true: the 256-bit [...]
     "customerKeyMD5": { "index": 13, "kind": "parameter", "displayName": 
"Customer Key MD5", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The base64-encoded 128-bit MD5 digest of the 
customer-provided key of customerK [...]
-    "useCustomerKey": { "index": 14, "kind": "parameter", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided k [...]
+    "useCustomerKey": { "index": 14, "kind": "parameter", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided k [...]
     "deleteAfterRead": { "index": 15, "kind": "parameter", "displayName": 
"Delete After Read", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to delete each 
consumed object from the bucket after its exchange compl [...]
     "destinationBucket": { "index": 16, "kind": "parameter", "displayName": 
"Destination Bucket", "group": "consumer", "label": "consumer", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The bucket that moveAfterRead copies the 
consumed objects to. The consumer checks at start [...]
     "destinationBucketPrefix": { "index": 17, "kind": "parameter", 
"displayName": "Destination Bucket Prefix", "group": "consumer", "label": 
"consumer", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"supportSimpleExpression": true, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "A prefix that moveAfterRead puts before the  
[...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
index 323abcc3a241..5556891d087a 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
@@ -284,6 +284,11 @@ object keeps its key in the other bucket.
 
 We introduced also the customer key support (an alternative of using KMS). The 
following code shows an example.
 
+NOTE: Amazon S3 blocks SSE-C by default on the general purpose buckets created 
since April 2026. An upload with a
+customer key to such a bucket, also one created by `autoCreateBucket=true`, is 
rejected with a `403 AccessDenied`.
+Allow SSE-C on the bucket before you use `useCustomerKey=true`, with 
`PutBucketEncryption` and `BlockedEncryptionTypes`
+set to `NONE`. Reading an object already stored with SSE-C is not affected.
+
 ._Java-only: programmatic customer key encryption setup_
 
 [source,java]
diff --git 
a/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
 
b/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
index e3e96b170d18..4a067b270c08 100644
--- 
a/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
+++ 
b/components/camel-aws/camel-aws2-s3/src/generated/resources/META-INF/org/apache/camel/component/aws2/s3/aws2-s3.json
@@ -38,7 +38,7 @@
     "customerAlgorithm": { "index": 11, "kind": "property", "displayName": 
"Customer Algorithm", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The encryption algorithm of SSE-C, used when 
useCustomerKey is true. S3 sup [...]
     "customerKeyId": { "index": 12, "kind": "property", "displayName": 
"Customer Key Id", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The customer-provided key of SSE-C, used when 
useCustomerKey is true: the 256-bit  [...]
     "customerKeyMD5": { "index": 13, "kind": "property", "displayName": 
"Customer Key MD5", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The base64-encoded 128-bit MD5 digest of the 
customer-provided key of customerKe [...]
-    "useCustomerKey": { "index": 14, "kind": "property", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided ke [...]
+    "useCustomerKey": { "index": 14, "kind": "property", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided ke [...]
     "bridgeErrorHandler": { "index": 15, "kind": "property", "displayName": 
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Allows for bridging the consumer to the Camel routing Error Handler, which 
mean any exceptions (if possible) occurred while the Camel consumer is trying 
to pickup incoming messages, or the lik [...]
     "deleteAfterRead": { "index": 16, "kind": "property", "displayName": 
"Delete After Read", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to delete each 
consumed object from the bucket after its exchange comple [...]
     "destinationBucket": { "index": 17, "kind": "property", "displayName": 
"Destination Bucket", "group": "consumer", "label": "consumer", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The bucket that moveAfterRead copies the 
consumed objects to. The consumer checks at startu [...]
@@ -169,7 +169,7 @@
     "customerAlgorithm": { "index": 11, "kind": "parameter", "displayName": 
"Customer Algorithm", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The encryption algorithm of SSE-C, used when 
useCustomerKey is true. S3 su [...]
     "customerKeyId": { "index": 12, "kind": "parameter", "displayName": 
"Customer Key Id", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The customer-provided key of SSE-C, used when 
useCustomerKey is true: the 256-bit [...]
     "customerKeyMD5": { "index": 13, "kind": "parameter", "displayName": 
"Customer Key MD5", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The base64-encoded 128-bit MD5 digest of the 
customer-provided key of customerK [...]
-    "useCustomerKey": { "index": 14, "kind": "parameter", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided k [...]
+    "useCustomerKey": { "index": 14, "kind": "parameter", "displayName": "Use 
Customer Key", "group": "common (advanced)", "label": "common,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to use 
server-side encryption with a customer-provided k [...]
     "deleteAfterRead": { "index": 15, "kind": "parameter", "displayName": 
"Delete After Read", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Whether to delete each 
consumed object from the bucket after its exchange compl [...]
     "destinationBucket": { "index": 16, "kind": "parameter", "displayName": 
"Destination Bucket", "group": "consumer", "label": "consumer", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "The bucket that moveAfterRead copies the 
consumed objects to. The consumer checks at start [...]
     "destinationBucketPrefix": { "index": 17, "kind": "parameter", 
"displayName": "Destination Bucket Prefix", "group": "consumer", "label": 
"consumer", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"supportSimpleExpression": true, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "A prefix that moveAfterRead puts before the  
[...]
diff --git 
a/components/camel-aws/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc 
b/components/camel-aws/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
index 323abcc3a241..5556891d087a 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
+++ b/components/camel-aws/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
@@ -284,6 +284,11 @@ object keeps its key in the other bucket.
 
 We introduced also the customer key support (an alternative of using KMS). The 
following code shows an example.
 
+NOTE: Amazon S3 blocks SSE-C by default on the general purpose buckets created 
since April 2026. An upload with a
+customer key to such a bucket, also one created by `autoCreateBucket=true`, is 
rejected with a `403 AccessDenied`.
+Allow SSE-C on the bucket before you use `useCustomerKey=true`, with 
`PutBucketEncryption` and `BlockedEncryptionTypes`
+set to `NONE`. Reading an object already stored with SSE-C is not affected.
+
 ._Java-only: programmatic customer key encryption setup_
 
 [source,java]
diff --git 
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
 
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
index 6e6f27246a2e..b50128367e5c 100644
--- 
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
+++ 
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
@@ -224,7 +224,10 @@ public class AWS2S3Configuration implements Cloneable, 
AwsCommonConfiguration {
                             + " customerKeyId, customerKeyMD5 and 
customerAlgorithm options. The key is sent with the get of"
                             + " each consumed object, and by the producer with 
PutObject, multipart uploads (also in"
                             + " streaming upload mode), getObject, 
getObjectRange and copyObject (for the source and the"
-                            + " copy). S3 needs the same key to read an object 
stored with it.")
+                            + " copy). S3 needs the same key to read an object 
stored with it. Amazon S3 blocks SSE-C by"
+                            + " default on the general purpose buckets created 
since April 2026 and rejects the uploads"
+                            + " with a 403 AccessDenied: allow it on the 
bucket first, with PutBucketEncryption and"
+                            + " BlockedEncryptionTypes set to NONE.")
     private boolean useCustomerKey;
     @UriParam(label = "common,advanced",
               description = "The customer-provided key of SSE-C, used when 
useCustomerKey is true: the 256-bit key"
diff --git 
a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
 
b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
index 49f140244d34..efc0a95d617b 100644
--- 
a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
+++ 
b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
@@ -23,17 +23,23 @@ import java.util.List;
 
 import javax.crypto.KeyGenerator;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.component.aws2.s3.AWS2S3Constants;
 import org.apache.camel.component.aws2.s3.AWS2S3Operations;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.services.s3.S3Client;
+import 
software.amazon.awssdk.services.s3.model.BucketAlreadyOwnedByYouException;
+import software.amazon.awssdk.services.s3.model.EncryptionType;
 import software.amazon.awssdk.services.s3.model.GetObjectRequest;
+import software.amazon.awssdk.services.s3.model.ServerSideEncryption;
 import software.amazon.awssdk.utils.Md5Utils;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -117,6 +123,29 @@ public class S3CopyObjectCustomerKeyIT extends Aws2S3Base {
         MockEndpoint.assertIsSatisfied(context);
     }
 
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+        S3Client s3Client = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class).getConfiguration()
+                .getAmazonS3Client();
+        // AWS blocks SSE-C on new buckets by default (and so do recent Floci 
versions): unblock it before using SSE-C
+        allowSseCustomerKey(s3Client, "mycamel");
+        allowSseCustomerKey(s3Client, "mycamel1");
+        return camelContext;
+    }
+
+    private static void allowSseCustomerKey(S3Client s3Client, String bucket) {
+        try {
+            s3Client.createBucket(b -> b.bucket(bucket));
+        } catch (BucketAlreadyOwnedByYouException e) {
+            // the bucket is already there, e.g. created by another test using 
the same service
+        }
+        s3Client.putBucketEncryption(b -> 
b.bucket(bucket).serverSideEncryptionConfiguration(
+                c -> c.rules(r -> r
+                        .applyServerSideEncryptionByDefault(d -> 
d.sseAlgorithm(ServerSideEncryption.AES256))
+                        .blockedEncryptionTypes(t -> 
t.encryptionType(EncryptionType.NONE)))));
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {

Reply via email to