From 35210f6407b03a683a349ec6ff1f8d5a0b5d7fcd Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:52:45 -0700 Subject: [PATCH 1/5] docs: Detail AWS SDK v2 support Corrects the README to state AWS SDK for Java 2.x support. Updates the JavaDocs for classes that use `KmsClient` interface to state the `KmsAsyncClient` is not supported. --- README.md | 8 +++++--- .../kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java | 6 +++++- .../encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java | 8 ++++++-- .../encryptionsdk/kmssdkv2/RegionalClientSupplier.java | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 587099702..0be086bb8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ For more details about the design and architecture of the AWS Encryption SDK, se [Security issue notifications](./CONTRIBUTING.md#security-issue-notifications) -See [Support Policy](./SUPPORT_POLICY.rst) for for details on the current support status of all major versions of this library. +See [Support Policy](./SUPPORT_POLICY.rst) for details on the current support status of all major versions of this library. ## Getting Started @@ -37,12 +37,14 @@ To use the AWS Encryption SDK for Java you must have: ### Optional Prerequisites #### AWS Integration -You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some of the [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java 1.x. (The AWS Encryption SDK for Java does not support the AWS SDK for Java 2.x.) +You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). * **To create an AWS account**, go to [Sign In or Create an AWS Account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) and then choose **I am a new user.** Follow the instructions to create an AWS account. * **To create a symmetric encryption KMS key in AWS KMS**, see [Creating Keys](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html). +* **To download and install the AWS SDK for Java 2.x**, see [Installing the AWS SDK for Java 2.x](https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/getting-started.html). + * **To download and install the AWS SDK for Java 1.x**, see [Installing the AWS SDK for Java 1.x](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/getting-started.html). #### Amazon Corretto Crypto Provider @@ -133,7 +135,7 @@ public class StringExample { } ``` -You can find more examples in the [examples directory][examples]. +You can find more examples in the [example directory][examples]. ## Public API diff --git a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java index 468130db2..d34993d14 100644 --- a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java +++ b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java @@ -107,7 +107,9 @@ public Builder discoveryMrkRegion(Region discoveryMrkRegion) { *

Because the regional client supplier fully controls the client construction process, it is * not possible to configure the client through methods such as {@link * #builderSupplier(Supplier)}; if you try to use these in combination, an {@link - * IllegalStateException} will be thrown. + * IllegalStateException} will be thrown.

+ * + *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

* * @see KmsMasterKeyProvider.Builder#customRegionalClientSupplier(RegionalClientSupplier) */ @@ -125,6 +127,8 @@ public Builder customRegionalClientSupplier(RegionalClientSupplier regionalClien * KmsClientBuilder} to configure KMS clients. Note that the region set on this builder will be * ignored, but all other settings will be propagated into the regional clients. * + *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ * * @see KmsMasterKeyProvider.Builder#builderSupplier(Supplier) */ public Builder builderSupplier(Supplier supplier) { diff --git a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java index 0203a3326..0887a84a2 100644 --- a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java +++ b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java @@ -87,7 +87,9 @@ public Builder defaultRegion(Region defaultRegion) { *

Because the regional client supplier fully controls the client construction process, it is * not possible to configure the client through methods such as {@link * #builderSupplier(Supplier)}; if you try to use these in combination, an {@link - * IllegalStateException} will be thrown. + * IllegalStateException} will be thrown.

+ * + *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

* * @param regionalClientSupplier * @return @@ -108,7 +110,9 @@ public Builder customRegionalClientSupplier(RegionalClientSupplier regionalClien * *

Trying to use this method in combination with {@link * #customRegionalClientSupplier(RegionalClientSupplier)} will cause an {@link - * IllegalStateException} to be thrown. + * IllegalStateException} to be thrown.

+ * + *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

* * @param supplier Should return a new {@link KmsClientBuilder} on each invocation. * @return diff --git a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java index 0716aea1e..172d3710c 100644 --- a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java +++ b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java @@ -9,6 +9,8 @@ public interface RegionalClientSupplier { * Supplies an {@link KmsClient} instance to use for a given {@link Region}. The {@link * KmsMasterKeyProvider} will not cache the result of this function. * + *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ * * @param region The region to get a client for * @return The client to use, or null if this region cannot or should not be used. */ From 71b40e14c2d5628911ed980d86a6eb2b336a6c82 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Thu, 9 Jun 2022 09:21:11 -0700 Subject: [PATCH 2/5] docs(README): async not supported --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0be086bb8..c6e568a0d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ To use the AWS Encryption SDK for Java you must have: ### Optional Prerequisites #### AWS Integration -You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). + You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). Note that the `KmsAsyncClient` is not supported, only the regular synchronous client. * **To create an AWS account**, go to [Sign In or Create an AWS Account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) and then choose **I am a new user.** Follow the instructions to create an AWS account. From 69b7a72f6213a1a8d2f8c7fdedd3c36a8e7241fb Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Thu, 9 Jun 2022 09:23:49 -0700 Subject: [PATCH 3/5] docs(README): fix spaceing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6e568a0d..1a6b9d975 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ To use the AWS Encryption SDK for Java you must have: ### Optional Prerequisites #### AWS Integration - You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). Note that the `KmsAsyncClient` is not supported, only the regular synchronous client. +You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). Note that the `KmsAsyncClient` is not supported, only the regular synchronous client. * **To create an AWS account**, go to [Sign In or Create an AWS Account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) and then choose **I am a new user.** Follow the instructions to create an AWS account. From 58e1198ecc29cb849fadfad51494c3dc2caa9ea7 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Thu, 9 Jun 2022 09:24:53 -0700 Subject: [PATCH 4/5] docs(README): fix langauge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a6b9d975..2c0f6ab14 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ To use the AWS Encryption SDK for Java you must have: ### Optional Prerequisites #### AWS Integration -You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). Note that the `KmsAsyncClient` is not supported, only the regular synchronous client. +You don't need an Amazon Web Services (AWS) account to use the AWS Encryption SDK, but some [example code][examples] require an AWS account, an AWS KMS key, and the AWS SDK for Java (either 1.x or 2.x). Note that the `KmsAsyncClient` is not supported, only the synchronous client. * **To create an AWS account**, go to [Sign In or Create an AWS Account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) and then choose **I am a new user.** Follow the instructions to create an AWS account. From 8fa0522e4a54e8fa79d5e991400536a330378aea Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 13 Jun 2022 18:32:20 -0700 Subject: [PATCH 5/5] style: run formatter --- .../kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java | 8 +++++--- .../encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java | 10 ++++++---- .../encryptionsdk/kmssdkv2/RegionalClientSupplier.java | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java index d34993d14..0fcbef2e9 100644 --- a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java +++ b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/AwsKmsMrkAwareMasterKeyProvider.java @@ -107,9 +107,10 @@ public Builder discoveryMrkRegion(Region discoveryMrkRegion) { *

Because the regional client supplier fully controls the client construction process, it is * not possible to configure the client through methods such as {@link * #builderSupplier(Supplier)}; if you try to use these in combination, an {@link - * IllegalStateException} will be thrown.

+ * IllegalStateException} will be thrown. * - *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} + * interface. * * @see KmsMasterKeyProvider.Builder#customRegionalClientSupplier(RegionalClientSupplier) */ @@ -127,7 +128,8 @@ public Builder customRegionalClientSupplier(RegionalClientSupplier regionalClien * KmsClientBuilder} to configure KMS clients. Note that the region set on this builder will be * ignored, but all other settings will be propagated into the regional clients. * - *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} + * interface. * * @see KmsMasterKeyProvider.Builder#builderSupplier(Supplier) */ diff --git a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java index 0887a84a2..50923113e 100644 --- a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java +++ b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/KmsMasterKeyProvider.java @@ -87,9 +87,10 @@ public Builder defaultRegion(Region defaultRegion) { *

Because the regional client supplier fully controls the client construction process, it is * not possible to configure the client through methods such as {@link * #builderSupplier(Supplier)}; if you try to use these in combination, an {@link - * IllegalStateException} will be thrown.

+ * IllegalStateException} will be thrown. * - *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} + * interface. * * @param regionalClientSupplier * @return @@ -110,9 +111,10 @@ public Builder customRegionalClientSupplier(RegionalClientSupplier regionalClien * *

Trying to use this method in combination with {@link * #customRegionalClientSupplier(RegionalClientSupplier)} will cause an {@link - * IllegalStateException} to be thrown.

+ * IllegalStateException} to be thrown. * - *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} + * interface. * * @param supplier Should return a new {@link KmsClientBuilder} on each invocation. * @return diff --git a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java index 172d3710c..0c5ecef8f 100644 --- a/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java +++ b/src/main/java/com/amazonaws/encryptionsdk/kmssdkv2/RegionalClientSupplier.java @@ -9,7 +9,7 @@ public interface RegionalClientSupplier { * Supplies an {@link KmsClient} instance to use for a given {@link Region}. The {@link * KmsMasterKeyProvider} will not cache the result of this function. * - *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface.

+ *

Note: The AWS Encryption SDK for Java does not support the {@code KmsAsyncClient} interface. * * @param region The region to get a client for * @return The client to use, or null if this region cannot or should not be used.