Skip to content

Commit bfc32c5

Browse files
authored
docs: add note in every example pointing out that encryption context is not secret (#184)
1 parent d5bd548 commit bfc32c5

26 files changed

+26
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final File sourcePlaintextFi
5454
decryptedFile.deleteOnExit();
5555

5656
// Prepare your encryption context.
57+
// Remember that your encryption context is NOT SECRET.
5758
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5859
final Map<String, String> encryptionContext = new HashMap<>();
5960
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
4444
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4545

4646
// Prepare your encryption context.
47+
// Remember that your encryption context is NOT SECRET.
4748
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4849
final Map<String, String> encryptionContext = new HashMap<>();
4950
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
3636
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3737

3838
// Prepare your encryption context.
39+
// Remember that your encryption context is NOT SECRET.
3940
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4041
final Map<String, String> encryptionContext = new HashMap<>();
4142
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5050
awsEncryptionSdk.setEncryptionAlgorithm(CryptoAlgorithm.ALG_AES_256_GCM_IV12_TAG16_HKDF_SHA256);
5151

5252
// Prepare your encryption context.
53+
// Remember that your encryption context is NOT SECRET.
5354
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5455
final Map<String, String> encryptionContext = new HashMap<>();
5556
encryptionContext.put("encryption", "context");

src/examples/java/com/amazonaws/crypto/examples/cryptomaterialsmanager/caching/SimpleCache.java

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5454
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5555

5656
// Prepare your encryption context.
57+
// Remember that your encryption context is NOT SECRET.
5758
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5859
final Map<String, String> encryptionContext = new HashMap<>();
5960
encryptionContext.put("encryption", "context");

src/examples/java/com/amazonaws/crypto/examples/cryptomaterialsmanager/custom/AlgorithmSuiteEnforcement.java

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
114114
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
115115

116116
// Prepare your encryption context.
117+
// Remember that your encryption context is NOT SECRET.
117118
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
118119
final Map<String, String> encryptionContext = new HashMap<>();
119120
encryptionContext.put("encryption", "context");

src/examples/java/com/amazonaws/crypto/examples/cryptomaterialsmanager/custom/RequiringEncryptionContextFields.java

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
103103
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
104104

105105
// Prepare your encryption context.
106+
// Remember that your encryption context is NOT SECRET.
106107
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
107108
final Map<String, String> encryptionContext = new HashMap<>();
108109
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final List<AwsKmsCmkId> awsK
5959
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
6060

6161
// Prepare your encryption context.
62+
// Remember that your encryption context is NOT SECRET.
6263
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
6364
final Map<String, String> encryptionContext = new HashMap<>();
6465
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
8989
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
9090

9191
// Prepare your encryption context.
92+
// Remember that your encryption context is NOT SECRET.
9293
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
9394
final Map<String, String> encryptionContext = new HashMap<>();
9495
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5252
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5353

5454
// Prepare your encryption context.
55+
// Remember that your encryption context is NOT SECRET.
5556
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5657
final Map<String, String> encryptionContext = new HashMap<>();
5758
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5757
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5858

5959
// Prepare your encryption context.
60+
// Remember that your encryption context is NOT SECRET.
6061
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
6162
final Map<String, String> encryptionContext = new HashMap<>();
6263
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
6464
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
6565

6666
// Prepare your encryption context.
67+
// Remember that your encryption context is NOT SECRET.
6768
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
6869
final Map<String, String> encryptionContext = new HashMap<>();
6970
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
7070
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
7171

7272
// Prepare your encryption context.
73+
// Remember that your encryption context is NOT SECRET.
7374
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
7475
final Map<String, String> encryptionContext = new HashMap<>();
7576
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static void run(final AwsKmsCmkId awsKmsGeneratorCmk, final List<AwsKmsCm
4848
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4949

5050
// Prepare your encryption context.
51+
// Remember that your encryption context is NOT SECRET.
5152
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5253
final Map<String, String> encryptionContext = new HashMap<>();
5354
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
4545
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4646

4747
// Prepare your encryption context.
48+
// Remember that your encryption context is NOT SECRET.
4849
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4950
final Map<String, String> encryptionContext = new HashMap<>();
5051
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5151
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5252

5353
// Prepare your encryption context.
54+
// Remember that your encryption context is NOT SECRET.
5455
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5556
final Map<String, String> encryptionContext = new HashMap<>();
5657
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public static void run(final byte[] sourcePlaintext) {
3636
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3737

3838
// Prepare your encryption context.
39+
// Remember that your encryption context is NOT SECRET.
3940
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4041
final Map<String, String> encryptionContext = new HashMap<>();
4142
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static void run(final byte[] sourcePlaintext) throws GeneralSecurityExcep
5050
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5151

5252
// Prepare your encryption context.
53+
// Remember that your encryption context is NOT SECRET.
5354
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5455
final Map<String, String> encryptionContext = new HashMap<>();
5556
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static void run(final byte[] sourcePlaintext) throws GeneralSecurityExcep
4040
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4141

4242
// Prepare your encryption context.
43+
// Remember that your encryption context is NOT SECRET.
4344
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4445
final Map<String, String> encryptionContext = new HashMap<>();
4546
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static void run(final byte[] sourcePlaintext) throws GeneralSecurityExcep
4747
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4848

4949
// Prepare your encryption context.
50+
// Remember that your encryption context is NOT SECRET.
5051
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5152
final Map<String, String> encryptionContext = new HashMap<>();
5253
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
4545
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4646

4747
// Prepare your encryption context.
48+
// Remember that your encryption context is NOT SECRET.
4849
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4950
final Map<String, String> encryptionContext = new HashMap<>();
5051
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public static void run(final AwsKmsCmkId awsKmsGeneratorCmk, final List<AwsKmsCm
4646
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4747

4848
// Prepare your encryption context.
49+
// Remember that your encryption context is NOT SECRET.
4950
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
5051
final Map<String, String> encryptionContext = new HashMap<>();
5152
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
4141
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
4242

4343
// Prepare your encryption context.
44+
// Remember that your encryption context is NOT SECRET.
4445
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4546
final Map<String, String> encryptionContext = new HashMap<>();
4647
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public static void run(final AwsKmsCmkId awsKmsCmk, final byte[] sourcePlaintext
5757
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
5858

5959
// Prepare your encryption context.
60+
// Remember that your encryption context is NOT SECRET.
6061
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
6162
final Map<String, String> encryptionContext = new HashMap<>();
6263
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static void run(final byte[] sourcePlaintext) {
3737
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3838

3939
// Prepare your encryption context.
40+
// Remember that your encryption context is NOT SECRET.
4041
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4142
final Map<String, String> encryptionContext = new HashMap<>();
4243
encryptionContext.put("encryption", "context");

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

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static void run(final byte[] sourcePlaintext) throws GeneralSecurityExcep
3737
final AwsCrypto awsEncryptionSdk = new AwsCrypto();
3838

3939
// Prepare your encryption context.
40+
// Remember that your encryption context is NOT SECRET.
4041
// https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context
4142
final Map<String, String> encryptionContext = new HashMap<>();
4243
encryptionContext.put("encryption", "context");

0 commit comments

Comments
 (0)