You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/04/17 13:43:58 UTC
[camel] 09/10: CAMEL-14845 - camel-aws2-s3 - CopyObject doesn't
support ServerSideEncryption, added example in docs
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0c35d9f0672f5daee51f8cf34e41e20c00fcbd15
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 17 15:24:46 2020 +0200
CAMEL-14845 - camel-aws2-s3 - CopyObject doesn't support ServerSideEncryption, added example in docs
---
.../src/main/docs/aws2-s3-component.adoc | 19 +++++++++++++++++++
...CopyObjectCustomerKeyOperationIntegrationTest.java | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc b/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
index b68ae1f..2647176 100644
--- a/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
+++ b/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
@@ -526,6 +526,25 @@ This will require specifying the destinationBucket option. As example:
In this case the objects consumed will be moved to myothercamelbucket bucket and deleted from the original one (because of deleteAfterRead set to true as default).
+== Using customer key as encryption
+
+We introduced also the customer key support (an alternative of using KMS). The following code shows an example.
+
+[source,java]
+--------------------------------------------------------------------------------
+String key = UUID.randomUUID().toString();
+byte[] secretKey = generateSecretKey();
+String b64Key = Base64.getEncoder().encodeToString(secretKey);
+String b64KeyMd5 = Md5Utils.md5AsBase64(secretKey);
+
+String awsEndpoint = "aws2-s3://mycamel?autoCreateBucket=false&useCustomerKey=true&customerKeyId=RAW(" + b64Key + ")&customerKeyMD5=RAW(" + b64KeyMd5 + ")&customerAlgorithm=" + AES256.name();
+
+from("direct:putObject")
+ .setHeader(AWS2S3Constants.KEY, constant("test.txt"))
+ .setBody(constant("Test"))
+ .to(awsEndpoint);
+--------------------------------------------------------------------------------
+
== Dependencies
Maven users will need to add the following dependency to their pom.xml.
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyOperationIntegrationTest.java
index fa723a9..d51a235 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyOperationIntegrationTest.java
@@ -125,7 +125,7 @@ public class S3CopyObjectCustomerKeyOperationIntegrationTest extends CamelTestSu
public void configure() throws Exception {
String awsEndpoint = "aws2-s3://mycamel?autoCreateBucket=false&useCustomerKey=true&customerKeyId=RAW(" + b64Key + ")&customerKeyMD5=RAW(" + b64KeyMd5 + ")&customerAlgorithm=" + AES256.name();
String awsEndpoint1 = "aws2-s3://mycamel1?autoCreateBucket=false&pojoRequest=true";
- from("direct:putObject").to(awsEndpoint);
+ from("direct:putObject").setHeader(AWS2S3Constants.KEY, constant("test.txt")).setBody(constant("Test")).to(awsEndpoint);
from("direct:copyObject").to(awsEndpoint);