19
19
* When you give the KMS keyring specific key IDs it will use those CMKs and nothing else.
20
20
* This is true both on encrypt and on decrypt.
21
21
* However, sometimes you need more flexibility on decrypt,
22
- * especially if you might not know beforehand which CMK was used to encrypt a message.
22
+ * especially when you don't know which CMKs were used to encrypt a message.
23
23
* To address this need, you can use a KMS discovery keyring.
24
- * The KMS discovery keyring will do nothing on encrypt
25
- * but will attempt to decrypt *any* data keys that were encrypted under a KMS CMK.
24
+ * The KMS discovery keyring does nothing on encrypt
25
+ * but attempts to decrypt *any* data keys that were encrypted under a KMS CMK.
26
26
* <p>
27
27
* This example shows how to configure and use a KMS discovery keyring.
28
28
* <p>
@@ -63,7 +63,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
63
63
// Create the keyring that determines how your data keys are protected.
64
64
final Keyring encryptKeyring = StandardKeyrings .awsKms (awsKmsCmk );
65
65
66
- // Create the KMS discovery keyring that we will use on decrypt.
66
+ // Create a KMS discovery keyring to use on decrypt.
67
67
final Keyring decryptKeyring = StandardKeyrings .awsKmsDiscoveryBuilder ().build ();
68
68
69
69
// Encrypt your plaintext data.
@@ -79,8 +79,8 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
79
79
80
80
// Decrypt your encrypted data using the KMS discovery keyring.
81
81
//
82
- // We do not need to specify the encryption context on decrypt
83
- // because the header message includes the encryption context.
82
+ // You do not need to specify the encryption context on decrypt because
83
+ // the header of the encrypted message includes the encryption context.
84
84
final AwsCryptoResult <byte []> decryptResult = awsEncryptionSdk .decrypt (
85
85
DecryptRequest .builder ()
86
86
.keyring (decryptKeyring )
0 commit comments