-
Notifications
You must be signed in to change notification settings - Fork 122
chore(docs): update README get started example #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
README.md
Outdated
// The data is correct, so output it. | ||
System.out.println("Decrypted: " + decryptResult.getResult()); | ||
System.out.println("Decrypted: " + Arrays.toString(decryptResult.getResult())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should print the decrypted data as a string since that's how it arrived:
System.out.println("Decrypted: " + Arrays.toString(decryptResult.getResult())); | |
System.out.println("Decrypted: " + new String(decryptResult.getResult(), StandardCharsets.UTF8)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It lets me comment only on the things that changed. This README can use a refresh, but we can do it in a separate revision pass.
README.md
Outdated
@@ -97,20 +99,22 @@ public class StringExample { | |||
|
|||
// Set up the master key provider | |||
final KmsMasterKeyProvider prov = KmsMasterKeyProvider.builder().buildStrict(keyArn); | |||
|
|||
// Set up encryption context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Set up encryption context | |
// Set up the encryption context |
README.md
Outdated
@@ -97,20 +99,22 @@ public class StringExample { | |||
|
|||
// Set up the master key provider | |||
final KmsMasterKeyProvider prov = KmsMasterKeyProvider.builder().buildStrict(keyArn); | |||
|
|||
// Set up encryption context | |||
final Map<String, String> context = Collections.singletonMap("ExampleContextKey", "ExampleContextValue"); | |||
|
|||
// Encrypt the data | |||
// | |||
// NOTE: Encrypted data should have associated encryption context | |||
// to protect integrity. For this example, just use a placeholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// to protect integrity. For this example, just use a placeholder | |
// to protect its integrity. This example uses placeholder values. |
We don't want to tell users to use placeholder values.
README.md
Outdated
@@ -97,20 +99,22 @@ public class StringExample { | |||
|
|||
// Set up the master key provider | |||
final KmsMasterKeyProvider prov = KmsMasterKeyProvider.builder().buildStrict(keyArn); | |||
|
|||
// Set up encryption context | |||
final Map<String, String> context = Collections.singletonMap("ExampleContextKey", "ExampleContextValue"); | |||
|
|||
// Encrypt the data | |||
// | |||
// NOTE: Encrypted data should have associated encryption context | |||
// to protect integrity. For this example, just use a placeholder | |||
// value. For more information about encryption context, see | |||
// https://amzn.to/1nSbe9X (blogs.aws.amazon.com) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md
Outdated
@@ -119,14 +123,15 @@ public class StringExample { | |||
|
|||
// The SDK may add information to the encryption context, so check to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The SDK may add information to the encryption context, so check to | |
// The AWS Encryption SDK may add information to the encryption context, so check to |
README.md
Outdated
@@ -119,14 +123,15 @@ public class StringExample { | |||
|
|||
// The SDK may add information to the encryption context, so check to | |||
// ensure all of the values are present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ensure all of the values are present | |
// ensure all of the values that you specified when encrypting are included in the returned encryption context. |
README.md
Outdated
} | ||
|
||
assert Arrays.equals(decryptResult.getResult(), data.getBytes(StandardCharsets.UTF_8)); | ||
|
||
// The data is correct, so output it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The data is correct, so output it. | |
// The data is correct, so return it. |
General edit; no technical changes.
## [2.4.0](v2.3.3...v2.4.0) (2022-03-09) ### Features * AWS SDK v2 support ([006cdc4](006cdc4)) ### Maintenance * Add back removed CiphertextHeaders.deserialize method ([#382](#382)) ([c1f3e63](c1f3e63)) * add build to support uploading artifacts ([#379](#379)) ([69e7914](69e7914)) * Add CODEOWNERS file ([#406](#406)) ([b9adf9f](b9adf9f)) * add javadoc update to batch build ([#376](#376)) ([d88190b](d88190b)) * Adding semantic release config file ([#346](#346)) ([6201c1a](6201c1a)) * **deps-dev:** bump junit-jupiter-api from 5.7.2 to 5.8.0 ([#339](#339)) ([6dfaef9](6dfaef9)) * **deps-dev:** bump junit-jupiter-api from 5.8.0 to 5.8.1 ([#347](#347)) ([7d3bb0a](7d3bb0a)) * **deps-dev:** bump junit-jupiter-api from 5.8.1 to 5.8.2 ([#427](#427)) ([7de569a](7de569a)) * **deps-dev:** bump junit-vintage-engine from 5.7.2 to 5.8.0 ([#337](#337)) ([2338b92](2338b92)) * **deps-dev:** bump junit-vintage-engine from 5.8.0 to 5.8.1 ([#348](#348)) ([d0221cf](d0221cf)) * **deps-dev:** bump junit-vintage-engine from 5.8.1 to 5.8.2 ([#426](#426)) ([065ab94](065ab94)) * **deps-dev:** bump mockito-core from 3.12.3 to 3.12.4 ([#323](#323)) ([0208d0d](0208d0d)) * **deps-dev:** bump mockito-core from 4.0.0 to 4.1.0 ([#441](#441)) ([8dfda1a](8dfda1a)) * **deps-dev:** bump mockito-core from 4.1.0 to 4.2.0 ([#458](#458)) ([a1b1885](a1b1885)) * **deps-dev:** bump mockito-core from 4.2.0 to 4.3.1 ([#500](#500)) ([a709e69](a709e69)) * **deps:** bump aws-java-sdk from 1.12.102 to 1.12.105 ([#404](#404)) ([b87d8c6](b87d8c6)) * **deps:** bump aws-java-sdk from 1.12.105 to 1.12.106 ([#405](#405)) ([dd633c0](dd633c0)) * **deps:** bump aws-java-sdk from 1.12.106 to 1.12.127 ([#436](#436)) ([91f6ffc](91f6ffc)) * **deps:** bump aws-java-sdk from 1.12.127 to 1.12.128 ([#437](#437)) ([37078ec](37078ec)) * **deps:** bump aws-java-sdk from 1.12.128 to 1.12.129 ([#447](#447)) ([6872c63](6872c63)) * **deps:** bump aws-java-sdk from 1.12.129 to 1.12.131 ([#463](#463)) ([a98a321](a98a321)) * **deps:** bump aws-java-sdk from 1.12.131 to 1.12.150 ([#508](#508)) ([433dc1b](433dc1b)) * **deps:** bump aws-java-sdk from 1.12.150 to 1.12.151 ([#510](#510)) ([70257a5](70257a5)) * **deps:** bump aws-java-sdk from 1.12.151 to 1.12.162 ([#541](#541)) ([22abc6c](22abc6c)) * **deps:** bump aws-java-sdk from 1.12.54 to 1.12.68 ([#341](#341)) ([291be0a](291be0a)) * **deps:** bump aws-java-sdk from 1.12.68 to 1.12.73 ([#350](#350)) ([153a0b3](153a0b3)) * **deps:** bump aws-java-sdk from 1.12.73 to 1.12.74 ([#351](#351)) ([e5f3962](e5f3962)) * **deps:** bump aws-java-sdk from 1.12.74 to 1.12.75 ([#353](#353)) ([3339c20](3339c20)) * **deps:** bump aws-java-sdk from 1.12.75 to 1.12.102 ([#400](#400)) ([98b079c](98b079c)) * **deps:** bump bcprov-ext-jdk15on from 1.69 to 1.70 ([#439](#439)) ([969852a](969852a)) * **deps:** bump build-helper-maven-plugin from 3.2.0 to 3.3.0 ([#473](#473)) ([4f7d08c](4f7d08c)) * **deps:** bump fmt-maven-plugin from 2.12 to 2.13 ([#429](#429)) ([e5d8c32](e5d8c32)) * **deps:** bump maven-compiler-plugin from 3.8.1 to 3.9.0 ([#481](#481)) ([369a049](369a049)) * **deps:** bump maven-javadoc-plugin from 3.3.0 to 3.3.1 ([#333](#333)) ([693e43f](693e43f)) * **deps:** bump nexus-staging-maven-plugin from 1.6.8 to 1.6.11 ([#535](#535)) ([0ab1db0](0ab1db0)) * **docs:** update README get started example ([#423](#423)) ([da0fe89](da0fe89)) * **docs:** updating broken javadoc link ([#366](#366)) ([487be4b](487be4b)) * moving and renaming buildspec.yml ([#360](#360)) ([e259caf](e259caf)) * release updates ([#369](#369)) ([4b9d932](4b9d932)) * source controlling cfn templates that will be used for our release process ([#345](#345)) ([456dda0](456dda0)) * update dependabot to update mainline-1.x ([#440](#440)) ([960f3e5](960f3e5)) * update gh token ([#412](#412)) ([f8ada9b](f8ada9b)) * update release process ([#396](#396)) ([c0ff093](c0ff093)) * update releaserc to include pom.xml file ([#357](#357)) ([63e2f05](63e2f05)) * update token name and timeout ([#411](#411)) ([c0d5a0e](c0d5a0e)) * updating prod template to remove resources and abstract ones ([#354](#354)) ([ecc17a6](ecc17a6)) * Upgrade mockito to 4.0.0 ([#438](#438)) ([629dbfd](629dbfd))
## [2.4.0](v2.3.3...v2.4.0) (2022-03-09) ### Features * AWS SDK v2 support ([006cdc4](006cdc4)) ### Maintenance * Add back removed CiphertextHeaders.deserialize method ([#382](#382)) ([c1f3e63](c1f3e63)) * add build to support uploading artifacts ([#379](#379)) ([69e7914](69e7914)) * Add CODEOWNERS file ([#406](#406)) ([b9adf9f](b9adf9f)) * add javadoc update to batch build ([#376](#376)) ([d88190b](d88190b)) * Adding semantic release config file ([#346](#346)) ([6201c1a](6201c1a)) * **deps-dev:** bump junit-jupiter-api from 5.7.2 to 5.8.0 ([#339](#339)) ([6dfaef9](6dfaef9)) * **deps-dev:** bump junit-jupiter-api from 5.8.0 to 5.8.1 ([#347](#347)) ([7d3bb0a](7d3bb0a)) * **deps-dev:** bump junit-jupiter-api from 5.8.1 to 5.8.2 ([#427](#427)) ([7de569a](7de569a)) * **deps-dev:** bump junit-vintage-engine from 5.7.2 to 5.8.0 ([#337](#337)) ([2338b92](2338b92)) * **deps-dev:** bump junit-vintage-engine from 5.8.0 to 5.8.1 ([#348](#348)) ([d0221cf](d0221cf)) * **deps-dev:** bump junit-vintage-engine from 5.8.1 to 5.8.2 ([#426](#426)) ([065ab94](065ab94)) * **deps-dev:** bump mockito-core from 3.12.3 to 3.12.4 ([#323](#323)) ([0208d0d](0208d0d)) * **deps-dev:** bump mockito-core from 4.0.0 to 4.1.0 ([#441](#441)) ([8dfda1a](8dfda1a)) * **deps-dev:** bump mockito-core from 4.1.0 to 4.2.0 ([#458](#458)) ([a1b1885](a1b1885)) * **deps-dev:** bump mockito-core from 4.2.0 to 4.3.1 ([#500](#500)) ([a709e69](a709e69)) * **deps:** bump aws-java-sdk from 1.12.102 to 1.12.105 ([#404](#404)) ([b87d8c6](b87d8c6)) * **deps:** bump aws-java-sdk from 1.12.105 to 1.12.106 ([#405](#405)) ([dd633c0](dd633c0)) * **deps:** bump aws-java-sdk from 1.12.106 to 1.12.127 ([#436](#436)) ([91f6ffc](91f6ffc)) * **deps:** bump aws-java-sdk from 1.12.127 to 1.12.128 ([#437](#437)) ([37078ec](37078ec)) * **deps:** bump aws-java-sdk from 1.12.128 to 1.12.129 ([#447](#447)) ([6872c63](6872c63)) * **deps:** bump aws-java-sdk from 1.12.129 to 1.12.131 ([#463](#463)) ([a98a321](a98a321)) * **deps:** bump aws-java-sdk from 1.12.131 to 1.12.150 ([#508](#508)) ([433dc1b](433dc1b)) * **deps:** bump aws-java-sdk from 1.12.150 to 1.12.151 ([#510](#510)) ([70257a5](70257a5)) * **deps:** bump aws-java-sdk from 1.12.151 to 1.12.162 ([#541](#541)) ([22abc6c](22abc6c)) * **deps:** bump aws-java-sdk from 1.12.54 to 1.12.68 ([#341](#341)) ([291be0a](291be0a)) * **deps:** bump aws-java-sdk from 1.12.68 to 1.12.73 ([#350](#350)) ([153a0b3](153a0b3)) * **deps:** bump aws-java-sdk from 1.12.73 to 1.12.74 ([#351](#351)) ([e5f3962](e5f3962)) * **deps:** bump aws-java-sdk from 1.12.74 to 1.12.75 ([#353](#353)) ([3339c20](3339c20)) * **deps:** bump aws-java-sdk from 1.12.75 to 1.12.102 ([#400](#400)) ([98b079c](98b079c)) * **deps:** bump bcprov-ext-jdk15on from 1.69 to 1.70 ([#439](#439)) ([969852a](969852a)) * **deps:** bump build-helper-maven-plugin from 3.2.0 to 3.3.0 ([#473](#473)) ([4f7d08c](4f7d08c)) * **deps:** bump fmt-maven-plugin from 2.12 to 2.13 ([#429](#429)) ([e5d8c32](e5d8c32)) * **deps:** bump maven-compiler-plugin from 3.8.1 to 3.9.0 ([#481](#481)) ([369a049](369a049)) * **deps:** bump maven-javadoc-plugin from 3.3.0 to 3.3.1 ([#333](#333)) ([693e43f](693e43f)) * **deps:** bump nexus-staging-maven-plugin from 1.6.11 to 1.6.12 ([#546](#546)) ([6fa782b](6fa782b)) * **deps:** bump nexus-staging-maven-plugin from 1.6.8 to 1.6.11 ([#535](#535)) ([0ab1db0](0ab1db0)) * **docs:** update README get started example ([#423](#423)) ([da0fe89](da0fe89)) * **docs:** updating broken javadoc link ([#366](#366)) ([487be4b](487be4b)) * moving and renaming buildspec.yml ([#360](#360)) ([e259caf](e259caf)) * release updates ([#369](#369)) ([4b9d932](4b9d932)) * source controlling cfn templates that will be used for our release process ([#345](#345)) ([456dda0](456dda0)) * update dependabot to update mainline-1.x ([#440](#440)) ([960f3e5](960f3e5)) * update gh token ([#412](#412)) ([f8ada9b](f8ada9b)) * update release process ([#396](#396)) ([c0ff093](c0ff093)) * update releaserc to include pom.xml file ([#357](#357)) ([63e2f05](63e2f05)) * update token name and timeout ([#411](#411)) ([c0d5a0e](c0d5a0e)) * updating prod template to remove resources and abstract ones ([#354](#354)) ([ecc17a6](ecc17a6)) * Upgrade mockito to 4.0.0 ([#438](#438)) ([629dbfd](629dbfd))
## [2.4.0](v2.3.3...v2.4.0) (2022-03-09) ### Features * AWS SDK v2 support ([006cdc4](006cdc4)) ### Fixes * Revert "AWS Encryption SDK 2.4.0 Release -- $(date +%Y-%m-%d)" ([7563a95](7563a95)) ### Maintenance * Add back removed CiphertextHeaders.deserialize method ([#382](#382)) ([c1f3e63](c1f3e63)) * add build to support uploading artifacts ([#379](#379)) ([69e7914](69e7914)) * Add CODEOWNERS file ([#406](#406)) ([b9adf9f](b9adf9f)) * add javadoc update to batch build ([#376](#376)) ([d88190b](d88190b)) * Adding semantic release config file ([#346](#346)) ([6201c1a](6201c1a)) * **ci:** change release vars ([#578](#578)) ([de99b56](de99b56)) * **deps-dev:** bump junit-jupiter-api from 5.7.2 to 5.8.0 ([#339](#339)) ([6dfaef9](6dfaef9)) * **deps-dev:** bump junit-jupiter-api from 5.8.0 to 5.8.1 ([#347](#347)) ([7d3bb0a](7d3bb0a)) * **deps-dev:** bump junit-jupiter-api from 5.8.1 to 5.8.2 ([#427](#427)) ([7de569a](7de569a)) * **deps-dev:** bump junit-vintage-engine from 5.7.2 to 5.8.0 ([#337](#337)) ([2338b92](2338b92)) * **deps-dev:** bump junit-vintage-engine from 5.8.0 to 5.8.1 ([#348](#348)) ([d0221cf](d0221cf)) * **deps-dev:** bump junit-vintage-engine from 5.8.1 to 5.8.2 ([#426](#426)) ([065ab94](065ab94)) * **deps-dev:** bump mockito-core from 3.12.3 to 3.12.4 ([#323](#323)) ([0208d0d](0208d0d)) * **deps-dev:** bump mockito-core from 4.0.0 to 4.1.0 ([#441](#441)) ([8dfda1a](8dfda1a)) * **deps-dev:** bump mockito-core from 4.1.0 to 4.2.0 ([#458](#458)) ([a1b1885](a1b1885)) * **deps-dev:** bump mockito-core from 4.2.0 to 4.3.1 ([#500](#500)) ([a709e69](a709e69)) * **deps:** bump aws-java-sdk from 1.12.102 to 1.12.105 ([#404](#404)) ([b87d8c6](b87d8c6)) * **deps:** bump aws-java-sdk from 1.12.105 to 1.12.106 ([#405](#405)) ([dd633c0](dd633c0)) * **deps:** bump aws-java-sdk from 1.12.106 to 1.12.127 ([#436](#436)) ([91f6ffc](91f6ffc)) * **deps:** bump aws-java-sdk from 1.12.127 to 1.12.128 ([#437](#437)) ([37078ec](37078ec)) * **deps:** bump aws-java-sdk from 1.12.128 to 1.12.129 ([#447](#447)) ([6872c63](6872c63)) * **deps:** bump aws-java-sdk from 1.12.129 to 1.12.131 ([#463](#463)) ([a98a321](a98a321)) * **deps:** bump aws-java-sdk from 1.12.131 to 1.12.150 ([#508](#508)) ([433dc1b](433dc1b)) * **deps:** bump aws-java-sdk from 1.12.150 to 1.12.151 ([#510](#510)) ([70257a5](70257a5)) * **deps:** bump aws-java-sdk from 1.12.151 to 1.12.162 ([#541](#541)) ([22abc6c](22abc6c)) * **deps:** bump aws-java-sdk from 1.12.54 to 1.12.68 ([#341](#341)) ([291be0a](291be0a)) * **deps:** bump aws-java-sdk from 1.12.68 to 1.12.73 ([#350](#350)) ([153a0b3](153a0b3)) * **deps:** bump aws-java-sdk from 1.12.73 to 1.12.74 ([#351](#351)) ([e5f3962](e5f3962)) * **deps:** bump aws-java-sdk from 1.12.74 to 1.12.75 ([#353](#353)) ([3339c20](3339c20)) * **deps:** bump aws-java-sdk from 1.12.75 to 1.12.102 ([#400](#400)) ([98b079c](98b079c)) * **deps:** bump bcprov-ext-jdk15on from 1.69 to 1.70 ([#439](#439)) ([969852a](969852a)) * **deps:** bump build-helper-maven-plugin from 3.2.0 to 3.3.0 ([#473](#473)) ([4f7d08c](4f7d08c)) * **deps:** bump fmt-maven-plugin from 2.12 to 2.13 ([#429](#429)) ([e5d8c32](e5d8c32)) * **deps:** bump maven-compiler-plugin from 3.8.1 to 3.9.0 ([#481](#481)) ([369a049](369a049)) * **deps:** bump maven-javadoc-plugin from 3.3.0 to 3.3.1 ([#333](#333)) ([693e43f](693e43f)) * **deps:** bump nexus-staging-maven-plugin from 1.6.11 to 1.6.12 ([#546](#546)) ([6fa782b](6fa782b)) * **deps:** bump nexus-staging-maven-plugin from 1.6.8 to 1.6.11 ([#535](#535)) ([0ab1db0](0ab1db0)) * **docs:** update README get started example ([#423](#423)) ([da0fe89](da0fe89)) * **docs:** updating broken javadoc link ([#366](#366)) ([487be4b](487be4b)) * moving and renaming buildspec.yml ([#360](#360)) ([e259caf](e259caf)) * release updates ([#369](#369)) ([4b9d932](4b9d932)) * source controlling cfn templates that will be used for our release process ([#345](#345)) ([456dda0](456dda0)) * update dependabot to update mainline-1.x ([#440](#440)) ([960f3e5](960f3e5)) * update gh token ([#412](#412)) ([f8ada9b](f8ada9b)) * update release process ([#396](#396)) ([c0ff093](c0ff093)) * update releaserc to include pom.xml file ([#357](#357)) ([63e2f05](63e2f05)) * update token name and timeout ([#411](#411)) ([c0d5a0e](c0d5a0e)) * updating prod template to remove resources and abstract ones ([#354](#354)) ([ecc17a6](ecc17a6)) * Upgrade mockito to 4.0.0 ([#438](#438)) ([629dbfd](629dbfd))
Issue #, if available:
419
Description of changes:
Updates README get started example to include new methods. Using encryptData and decryptData.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: