Skip to content

Commit c81a95d

Browse files
authored
Create README.md
General edit; no technical changes.
1 parent f633791 commit c81a95d

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

README.md

+26-29
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# AWS Encryption SDK for Java
22

3-
The AWS Encryption SDK enables secure client-side encryption. It uses cryptography best practices to protect your data and the encryption keys used to protect that data. Each data object is protected with a unique data encryption key (DEK), and the DEK is protected with a key encryption key (KEK) called a *master key*. The encrypted DEK is combined with the encrypted data into a single [encrypted message](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/message-format.html), so you don't need to keep track of the DEKs for your data. The SDK supports master keys in [AWS Key Management Service](https://aws.amazon.com/kms/) (KMS), and it also provides APIs to define and use other master key providers. The SDK provides methods for encrypting and decrypting strings, byte arrays, and byte streams. For details, see the [example code][examples] and the [Javadoc](https://aws.github.io/aws-encryption-sdk-java).
3+
The AWS Encryption SDK enables secure client-side encryption. It uses cryptography best practices to protect your data and protect the encryption keys that protect your data. Each data object is protected with a unique data encryption key, and the data encryption key is protected with a key encryption key called a *wrapping key* or *master key*. The encryption method returns a single, portable [encrypted message](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/message-format.html) that contains the encrypted data and the encrypted data key, so you don't need to keep track of the data encryption keys for your data. You can use KMS keys in [AWS Key Management Service](https://aws.amazon.com/kms/) (AWS KMS) as wrapping keys. The AWS Encryption SDK also provides APIs to define and use encryption keys from other key providers.
44

5-
For more details about the design and architecture of the SDK, see the [official documentation](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/).
5+
The AWS Encryption SDK for Java provides methods for encrypting and decrypting strings, byte arrays, and byte streams. For details, see the [example code][examples] and the [Javadoc](https://aws.github.io/aws-encryption-sdk-java).
6+
7+
For more details about the design and architecture of the AWS Encryption SDK, see the [AWS Encryption SDK Developer Guide](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/).
68

79
[Security issue notifications](./CONTRIBUTING.md#security-issue-notifications)
810

@@ -11,7 +13,7 @@ See [Support Policy](./SUPPORT_POLICY.rst) for for details on the current suppor
1113
## Getting Started
1214

1315
### Required Prerequisites
14-
To use this SDK you must have:
16+
To use the AWS Encryption SDK for Java you must have:
1517

1618
* **A Java 8 or newer development environment**
1719

@@ -29,29 +31,25 @@ To use this SDK you must have:
2931
If you do not have Bouncy Castle, go to https://bouncycastle.org/latest_releases.html, then download the provider file that corresponds to your JDK.
3032
Or, you can pick it up from Maven (groupId: `org.bouncycastle`, artifactId: `bcprov-ext-jdk15on`).
3133

32-
Beginning in version 1.6.1,
33-
the AWS Encryption SDK also works with Bouncy Castle FIPS (groupId: `org.bouncycastle`, artifactId: `bc-fips`)
34-
as an alternative to non-FIPS Bouncy Castle.
35-
For help installing and configuring Bouncy Castle FIPS properly, see [BC FIPS documentation](https://www.bouncycastle.org/documentation.html),
36-
in particular, **User Guides** and **Security Policy**.
34+
Beginning in version 1.6.1, the AWS Encryption SDK for Java also works with Bouncy Castle FIPS (groupId: `org.bouncycastle`, artifactId: `bc-fips`)
35+
as an alternative to non-FIPS Bouncy Castle. For help installing and configuring Bouncy Castle FIPS, see [BC FIPS documentation](https://www.bouncycastle.org/documentation.html), in particular, **User Guides** and **Security Policy**.
3736

3837
### Optional Prerequisites
3938

4039
#### AWS Integration
41-
You don't need an Amazon Web Services (AWS) account to use this SDK, but some of the [example code][examples] requires an AWS account, a customer master key (CMK) in AWS KMS, and the AWS SDK for Java.
40+
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.)
4241

4342
* **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.
4443

45-
* **To create a CMK in AWS KMS**, go to [Creating Keys](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html) in the KMS documentation and then follow the instructions on that page.
44+
* **To create a symmetric encryption KMS key in AWS KMS**, see [Creating Keys](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html).
4645

47-
* **To download and install the AWS SDK for Java**, go to [Installing the AWS SDK for Java](https://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-install-sdk.html) in the AWS SDK for Java documentation and then follow the instructions on that page.
46+
* **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).
4847

4948
#### Amazon Corretto Crypto Provider
5049
Many users find that the Amazon Corretto Crypto Provider (ACCP) significantly improves the performance of the AWS Encryption SDK.
51-
For help installing and using ACCP, see the [ACCP GitHub Respository](https://github.com/corretto/amazon-corretto-crypto-provider) .
52-
53-
### Download
50+
For help installing and using ACCP, see the [amazon-corretto-crypto-provider repository](https://github.com/corretto/amazon-corretto-crypto-provider).
5451

52+
### Download the AWS Encryption SDK for Java
5553
You can get the latest release from Maven:
5654

5755
```xml
@@ -63,15 +61,14 @@ You can get the latest release from Maven:
6361
```
6462

6563
### Get Started
64+
To get started with the AWS Encryption SDK for Java
6665

67-
The following code sample demonstrates how to get started:
68-
69-
1. Instantiate the SDK.
66+
1. Instantiate the AWS Encryption SDK.
7067
2. Define the master key provider.
7168
3. Encrypt and decrypt data.
7269

7370
```java
74-
// This sample code encrypts and then decrypts a string using a KMS CMK.
71+
// This sample code encrypts and then decrypts a string using an AWS KMS key.
7572
// You provide the KMS key ARN and plaintext string as arguments.
7673
package com.amazonaws.crypto.examples;
7774

@@ -88,11 +85,11 @@ import com.amazonaws.encryptionsdk.kms.KmsMasterKeyProvider;
8885

8986
public class StringExample {
9087
private static String keyArn;
91-
private static String data;
88+
private static String plaintext;
9289

9390
public static void main(final String[] args) {
9491
keyArn = args[0];
95-
data = args[1];
92+
plaintext = args[1];
9693

9794
// Instantiate the SDK
9895
final AwsCrypto crypto = AwsCrypto.standard();
@@ -101,28 +98,28 @@ public class StringExample {
10198
final KmsMasterKeyProvider prov = KmsMasterKeyProvider.builder().buildStrict(keyArn);
10299

103100
// Set up the encryption context
104-
final Map<String, String> context = Collections.singletonMap("ExampleContextKey", "ExampleContextValue");
105-
106-
// Encrypt the data
107-
//
108101
// NOTE: Encrypted data should have associated encryption context
109102
// to protect its integrity. This example uses placeholder values.
110-
// For more information about encryption context, see
103+
// For more information about the encryption context, see
111104
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
112-
final CryptoResult<byte[], KmsMasterKey> encryptResult = crypto.encryptData(prov, data.getBytes(StandardCharsets.UTF_8), context);
105+
final Map<String, String> context = Collections.singletonMap("ExampleContextKey", "ExampleContextValue");
106+
107+
// Encrypt the data
108+
//
109+
final CryptoResult<byte[], KmsMasterKey> encryptResult = crypto.encryptData(prov, plaintext.getBytes(StandardCharsets.UTF_8), context);
113110
final byte[] ciphertext = encryptResult.getResult();
114111
System.out.println("Ciphertext: " + Arrays.toString(ciphertext));
115112

116113
// Decrypt the data
117114
final CryptoResult<byte[], KmsMasterKey> decryptResult = crypto.decryptData(prov, ciphertext);
118-
// Check the encryption context (and ideally the master key) to
119-
// ensure this is the expected ciphertext
115+
// Your application should verify the encryption context and the KMS key to
116+
// ensure this is the expected ciphertext before returning the plaintext
120117
if (!decryptResult.getMasterKeyIds().get(0).equals(keyArn)) {
121118
throw new IllegalStateException("Wrong key id!");
122119
}
123120

124121
// The AWS Encryption SDK may add information to the encryption context, so check to
125-
// ensure all of the values that you specified when encrypting are included in the returned encryption context.
122+
// ensure all of the values that you specified when encrypting are *included* in the returned encryption context.
126123
if (!context.entrySet().stream
127124
.allMatch( e -> e.getValue().equals(decryptResult.getEncryptionContext().get(e.getKey())))) {
128125
throw new IllegalStateException("Wrong Encryption Context!");

0 commit comments

Comments
 (0)