Skip to content

Commit 619ad06

Browse files
Adding periods
1 parent 2ad02ff commit 619ad06

21 files changed

+64
-64
lines changed

src/examples/java/com/amazonaws/crypto/examples/FileStreamingDefaults.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class FileStreamingDefaults {
4343
* @param sourcePlaintextFile Plaintext file to encrypt
4444
*/
4545
public static void run(final AwsKmsCmkId awsKmsCmk, final File sourcePlaintextFile) throws IOException {
46-
// Instantiate the AWS Encryption SDK
46+
// Instantiate the AWS Encryption SDK.
4747
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4848

4949
// We assume that you can also write to the directory containing the plaintext file,

src/examples/java/com/amazonaws/crypto/examples/InMemoryStreamingDefaults.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class InMemoryStreamingDefaults {
4040
* @param sourcePlaintext Plaintext to encrypt
4141
*/
4242
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) throws IOException {
43-
// Instantiate the AWS Encryption SDK
43+
// Instantiate the AWS Encryption SDK.
4444
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4545

4646
// Prepare your encryption context.

src/examples/java/com/amazonaws/crypto/examples/OneStepDefaults.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class OneStepDefaults {
3232
* @param sourcePlaintext Plaintext to encrypt
3333
*/
3434
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
35-
// Instantiate the AWS Encryption SDK
35+
// Instantiate the AWS Encryption SDK.
3636
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3737

3838
// Prepare your encryption context.
@@ -55,7 +55,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5555
.plaintext(sourcePlaintext).build());
5656
final byte[] ciphertext = encryptResult.getResult();
5757

58-
// Demonstrate that the ciphertext and plaintext are different
58+
// Demonstrate that the ciphertext and plaintext are different.
5959
assert !Arrays.equals(ciphertext, sourcePlaintext);
6060

6161
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/OneStepUnsigned.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
6969
.plaintext(sourcePlaintext).build());
7070
final byte[] ciphertext = encryptResult.getResult();
7171

72-
// Demonstrate that the ciphertext and plaintext are different
72+
// Demonstrate that the ciphertext and plaintext are different.
7373
assert !Arrays.equals(ciphertext, sourcePlaintext);
7474

7575
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/CustomClientSupplier.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public AWSKMS getClient(String regionId) {
8585
* @param sourcePlaintext Plaintext to encrypt
8686
*/
8787
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
88-
// Instantiate the AWS Encryption SDK
88+
// Instantiate the AWS Encryption SDK.
8989
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
9090

9191
// Prepare your encryption context.
@@ -111,7 +111,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
111111
.plaintext(sourcePlaintext).build());
112112
final byte[] ciphertext = encryptResult.getResult();
113113

114-
// Demonstrate that the ciphertext and plaintext are different
114+
// Demonstrate that the ciphertext and plaintext are different.
115115
assert !Arrays.equals(ciphertext, sourcePlaintext);
116116

117117
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/CustomKmsClientConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class CustomKmsClientConfig {
4848
* @param sourcePlaintext Plaintext to encrypt
4949
*/
5050
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
51-
// Instantiate the AWS Encryption SDK
51+
// Instantiate the AWS Encryption SDK.
5252
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5353

5454
// Prepare your encryption context.
@@ -90,7 +90,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
9090
.plaintext(sourcePlaintext).build());
9191
final byte[] ciphertext = encryptResult.getResult();
9292

93-
// Demonstrate that the ciphertext and plaintext are different
93+
// Demonstrate that the ciphertext and plaintext are different.
9494
assert !Arrays.equals(ciphertext, sourcePlaintext);
9595

9696
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/DiscoveryDecrypt.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class DiscoveryDecrypt {
4848
* @param sourcePlaintext Plaintext to encrypt
4949
*/
5050
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
51-
// Instantiate the AWS Encryption SDK
51+
// Instantiate the AWS Encryption SDK.
5252
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5353

5454
// Prepare your encryption context.
@@ -74,7 +74,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
7474
.plaintext(sourcePlaintext).build());
7575
final byte[] ciphertext = encryptResult.getResult();
7676

77-
// Demonstrate that the ciphertext and plaintext are different
77+
// Demonstrate that the ciphertext and plaintext are different.
7878
assert !Arrays.equals(ciphertext, sourcePlaintext);
7979

8080
// Decrypt your encrypted data using the KMS discovery keyring.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/DiscoveryDecryptInRegionOnly.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class DiscoveryDecryptInRegionOnly {
5555
* @param sourcePlaintext Plaintext to encrypt
5656
*/
5757
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
58-
// Instantiate the AWS Encryption SDK
58+
// Instantiate the AWS Encryption SDK.
5959
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
6060

6161
// Prepare your encryption context.
@@ -90,7 +90,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
9090
.plaintext(sourcePlaintext).build());
9191
final byte[] ciphertext = encryptResult.getResult();
9292

93-
// Demonstrate that the ciphertext and plaintext are different
93+
// Demonstrate that the ciphertext and plaintext are different.
9494
assert !Arrays.equals(ciphertext, sourcePlaintext);
9595

9696
// Decrypt your encrypted data using the KMS discovery keyring.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/DiscoveryDecryptWithPreferredRegions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class DiscoveryDecryptWithPreferredRegions {
6161
* @param sourcePlaintext Plaintext to encrypt
6262
*/
6363
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
64-
// Instantiate the AWS Encryption SDK
64+
// Instantiate the AWS Encryption SDK.
6565
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
6666

6767
// Prepare your encryption context.
@@ -106,7 +106,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
106106
.plaintext(sourcePlaintext).build());
107107
final byte[] ciphertext = encryptResult.getResult();
108108

109-
// Demonstrate that the ciphertext and plaintext are different
109+
// Demonstrate that the ciphertext and plaintext are different.
110110
assert !Arrays.equals(ciphertext, sourcePlaintext);
111111

112112
// Decrypt your encrypted data using the multi keyring.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/MultipleRegions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class MultipleRegions {
4444
* @param sourcePlaintext Plaintext to encrypt
4545
*/
4646
public static void run(final AwsKmsCmkId awsKmsGeneratorCmk, final List<AwsKmsCmkId> awsKmsAdditionalCmks, byte[] sourcePlaintext) {
47-
// Instantiate the AWS Encryption SDK
47+
// Instantiate the AWS Encryption SDK.
4848
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4949

5050
// Prepare your encryption context.
@@ -87,7 +87,7 @@ public static void run(final AwsKmsCmkId awsKmsGeneratorCmk, final List<AwsKmsCm
8787
// It should contain one EDK for each CMK.
8888
assert encryptResult.getHeaders().getEncryptedKeyBlobCount() == awsKmsAdditionalCmks.size() + 1;
8989

90-
// Demonstrate that the ciphertext and plaintext are different
90+
// Demonstrate that the ciphertext and plaintext are different.
9191
assert !Arrays.equals(ciphertext, sourcePlaintext);
9292

9393
// Decrypt your encrypted data separately using the single-CMK keyrings.

src/examples/java/com/amazonaws/crypto/examples/keyring/awskms/SingleCmk.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class SingleCmk {
4141
* @param sourcePlaintext Plaintext to encrypt
4242
*/
4343
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) {
44-
// Instantiate the AWS Encryption SDK
44+
// Instantiate the AWS Encryption SDK.
4545
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4646

4747
// Prepare your encryption context.
@@ -64,7 +64,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
6464
.plaintext(sourcePlaintext).build());
6565
final byte[] ciphertext = encryptResult.getResult();
6666

67-
// Demonstrate that the ciphertext and plaintext are different
67+
// Demonstrate that the ciphertext and plaintext are different.
6868
assert !Arrays.equals(ciphertext, sourcePlaintext);
6969

7070
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/keyring/multi/AwsKmsWithEscrow.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class AwsKmsWithEscrow {
4747
* @param sourcePlaintext Plaintext to encrypt
4848
*/
4949
public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext) throws GeneralSecurityException {
50-
// Instantiate the AWS Encryption SDK
50+
// Instantiate the AWS Encryption SDK.
5151
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5252

5353
// Prepare your encryption context.

src/examples/java/com/amazonaws/crypto/examples/keyring/rawaes/RawAes.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class RawAes {
3232
* @param sourcePlaintext Plaintext to encrypt
3333
*/
3434
public static void run(final byte[] sourcePlaintext) {
35-
// Instantiate the AWS Encryption SDK
35+
// Instantiate the AWS Encryption SDK.
3636
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3737

3838
// Prepare your encryption context.
@@ -73,7 +73,7 @@ public static void run(final byte[] sourcePlaintext) {
7373
.plaintext(sourcePlaintext).build());
7474
final byte[] ciphertext = encryptResult.getResult();
7575

76-
// Demonstrate that the ciphertext and plaintext are different
76+
// Demonstrate that the ciphertext and plaintext are different.
7777
assert !Arrays.equals(ciphertext, sourcePlaintext);
7878

7979
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/keyring/rawrsa/PublicPrivateKeySeparate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class PublicPrivateKeySeparate {
4343
* @param sourcePlaintext Plaintext to encrypt
4444
*/
4545
public static void run(final byte[] sourcePlaintext) throws GeneralSecurityException {
46-
// Instantiate the AWS Encryption SDK
46+
// Instantiate the AWS Encryption SDK.
4747
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4848

4949
// Prepare your encryption context.
@@ -100,7 +100,7 @@ public static void run(final byte[] sourcePlaintext) throws GeneralSecurityExcep
100100
.plaintext(sourcePlaintext).build());
101101
final byte[] ciphertext = encryptResult.getResult();
102102

103-
// Demonstrate that the ciphertext and plaintext are different
103+
// Demonstrate that the ciphertext and plaintext are different.
104104
assert !Arrays.equals(ciphertext, sourcePlaintext);
105105

106106
// Try to decrypt your encrypted data using the *encrypt* keyring.

src/examples/java/com/amazonaws/crypto/examples/keyring/rawrsa/RawRsa.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class RawRsa {
3333
* @param sourcePlaintext Plaintext to encrypt
3434
*/
3535
public static void run(final byte[] sourcePlaintext) throws GeneralSecurityException {
36-
// Instantiate the AWS Encryption SDK
36+
// Instantiate the AWS Encryption SDK.
3737
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3838

3939
// Prepare your encryption context.
@@ -79,7 +79,7 @@ public static void run(final byte[] sourcePlaintext) throws GeneralSecurityExcep
7979
.plaintext(sourcePlaintext).build());
8080
final byte[] ciphertext = encryptResult.getResult();
8181

82-
// Demonstrate that the ciphertext and plaintext are different
82+
// Demonstrate that the ciphertext and plaintext are different.
8383
assert !Arrays.equals(ciphertext, sourcePlaintext);
8484

8585
// Decrypt your encrypted data using the same keyring you used on encrypt.

src/examples/java/com/amazonaws/crypto/examples/legacy/BasicEncryptionExample.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ public static void main(final String[] args) {
3838
}
3939

4040
static void encryptAndDecrypt(final String keyArn) {
41-
// 1. Instantiate the AWS Encryption SDK
41+
// 1. Instantiate the AWS Encryption SDK.
4242
final AwsCrypto crypto = new AwsCrypto();
4343

44-
// 2. Instantiate a KMS master key provider
44+
// 2. Instantiate a KMS master key provider.
4545
final KmsMasterKeyProvider masterKeyProvider = KmsMasterKeyProvider.builder().withKeysForEncryption(keyArn).build();
4646

47-
// 3. Create an encryption context
47+
// 3. Create an encryption context.
4848
//
4949
// Most encrypted data should have an associated encryption context
5050
// to protect integrity. This sample uses placeholder values.
@@ -53,11 +53,11 @@ static void encryptAndDecrypt(final String keyArn) {
5353
// blogs.aws.amazon.com/security/post/Tx2LZ6WBJJANTNW/How-to-Protect-the-Integrity-of-Your-Encrypted-Data-by-Using-AWS-Key-Management
5454
final Map<String, String> encryptionContext = Collections.singletonMap("ExampleContextKey", "ExampleContextValue");
5555

56-
// 4. Encrypt the data
56+
// 4. Encrypt the data.
5757
final CryptoResult<byte[], KmsMasterKey> encryptResult = crypto.encryptData(masterKeyProvider, EXAMPLE_DATA, encryptionContext);
5858
final byte[] ciphertext = encryptResult.getResult();
5959

60-
// 5. Decrypt the data
60+
// 5. Decrypt the data.
6161
final CryptoResult<byte[], KmsMasterKey> decryptResult = crypto.decryptData(masterKeyProvider, ciphertext);
6262

6363
// 6. Before verifying the plaintext, verify that the customer master key that
@@ -75,7 +75,7 @@ static void encryptAndDecrypt(final String keyArn) {
7575
throw new IllegalStateException("Wrong Encryption Context!");
7676
}
7777

78-
// 8. Verify that the decrypted plaintext matches the original plaintext
78+
// 8. Verify that the decrypted plaintext matches the original plaintext.
7979
assert Arrays.equals(decryptResult.getResult(), EXAMPLE_DATA);
8080
}
8181
}

src/examples/java/com/amazonaws/crypto/examples/legacy/EscrowedEncryptExample.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ public static void main(final String[] args) throws Exception {
7070

7171
private static void standardEncrypt(final String kmsArn, final String fileName) throws Exception {
7272
// Encrypt with the KMS CMK and the escrowed public key
73-
// 1. Instantiate the AWS Encryption SDK
73+
// 1. Instantiate the AWS Encryption SDK.
7474
final AwsCrypto crypto = new AwsCrypto();
7575

76-
// 2. Instantiate a KMS master key provider
76+
// 2. Instantiate a KMS master key provider.
7777
final KmsMasterKeyProvider kms = new KmsMasterKeyProvider(kmsArn);
7878

79-
// 3. Instantiate a JCE master key provider
79+
// 3. Instantiate a JCE master key provider.
8080
// Because the user does not have access to the private escrow key,
8181
// they pass in "null" for the private key parameter.
8282
final JceMasterKey escrowPub = JceMasterKey.getInstance(publicEscrowKey, null, "Escrow", "Escrow",
8383
"RSA/ECB/OAEPWithSHA-512AndMGF1Padding");
8484

85-
// 4. Combine the providers into a single master key provider
85+
// 4. Combine the providers into a single master key provider.
8686
final MasterKeyProvider<?> provider = MultipleProviderFactory.buildMultiProvider(kms, escrowPub);
8787

88-
// 5. Encrypt the file
88+
// 5. Encrypt the file.
8989
// To simplify the code, we omit the encryption context. Production code should always
9090
// use an encryption context. For an example, see the other SDK samples.
9191
final FileInputStream in = new FileInputStream(fileName);
@@ -101,22 +101,22 @@ private static void standardDecrypt(final String kmsArn, final String fileName)
101101
// Decrypt with the KMS CMK and the escrow public key. You can use a combined provider,
102102
// as shown here, or just the KMS master key provider.
103103

104-
// 1. Instantiate the AWS Encryption SDK
104+
// 1. Instantiate the AWS Encryption SDK.
105105
final AwsCrypto crypto = new AwsCrypto();
106106

107-
// 2. Instantiate a KMS master key provider
107+
// 2. Instantiate a KMS master key provider.
108108
final KmsMasterKeyProvider kms = new KmsMasterKeyProvider(kmsArn);
109109

110-
// 3. Instantiate a JCE master key provider
110+
// 3. Instantiate a JCE master key provider.
111111
// Because the user does not have access to the private
112112
// escrow key, they pass in "null" for the private key parameter.
113113
final JceMasterKey escrowPub = JceMasterKey.getInstance(publicEscrowKey, null, "Escrow", "Escrow",
114114
"RSA/ECB/OAEPWithSHA-512AndMGF1Padding");
115115

116-
// 4. Combine the providers into a single master key provider
116+
// 4. Combine the providers into a single master key provider.
117117
final MasterKeyProvider<?> provider = MultipleProviderFactory.buildMultiProvider(kms, escrowPub);
118118

119-
// 5. Decrypt the file
119+
// 5. Decrypt the file.
120120
// To simplify the code, we omit the encryption context. Production code should always
121121
// use an encryption context. For an example, see the other SDK samples.
122122
final FileInputStream in = new FileInputStream(fileName + ".encrypted");
@@ -131,15 +131,15 @@ private static void escrowDecrypt(final String fileName) throws Exception {
131131
// You can decrypt the stream using only the private key.
132132
// This method does not call KMS.
133133

134-
// 1. Instantiate the AWS Encryption SDK
134+
// 1. Instantiate the AWS Encryption SDK.
135135
final AwsCrypto crypto = new AwsCrypto();
136136

137-
// 2. Instantiate a JCE master key provider
138-
// This method call uses the escrowed private key, not null
137+
// 2. Instantiate a JCE master key provider.
138+
// This method call uses the escrowed private key, not null.
139139
final JceMasterKey escrowPriv = JceMasterKey.getInstance(publicEscrowKey, privateEscrowKey, "Escrow", "Escrow",
140140
"RSA/ECB/OAEPWithSHA-512AndMGF1Padding");
141141

142-
// 3. Decrypt the file
142+
// 3. Decrypt the file.
143143
// To simplify the code, we omit the encryption context. Production code should always
144144
// use an encryption context. For an example, see the other SDK samples.
145145
final FileInputStream in = new FileInputStream(fileName + ".encrypted");

src/examples/java/com/amazonaws/crypto/examples/legacy/FileStreamingExample.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ public static void main(String[] args) throws IOException {
4343
srcFile = args[0];
4444

4545
// In this example, we generate a random key. In practice,
46-
// you would get a key from an existing store
46+
// you would get a key from an existing store.
4747
SecretKey cryptoKey = retrieveEncryptionKey();
4848

49-
// Create a JCE master key provider using the random key and an AES-GCM encryption algorithm
49+
// Create a JCE master key provider using the random key and an AES-GCM encryption algorithm.
5050
JceMasterKey masterKey = JceMasterKey.getInstance(cryptoKey, "Example", "RandomKey", "AES/GCM/NoPadding");
5151

52-
// Instantiate the AWS Encryption SDK
52+
// Instantiate the AWS Encryption SDK.
5353
AwsCrypto crypto = new AwsCrypto();
5454

55-
// Create an encryption context to identify this ciphertext
55+
// Create an encryption context to identify this ciphertext.
5656
Map<String, String> context = Collections.singletonMap("Example", "FileStreaming");
5757

5858
// Because the file might be to large to load into memory, we stream the data, instead of
@@ -73,7 +73,7 @@ public static void main(String[] args) throws IOException {
7373
throw new IllegalStateException("Bad encryption context");
7474
}
7575

76-
// Return the plaintext data
76+
// Return the plaintext data.
7777
out = new FileOutputStream(srcFile + ".decrypted");
7878
IOUtils.copy(decryptingStream, out);
7979
decryptingStream.close();

0 commit comments

Comments
 (0)