Skip to content

Commit c2fd000

Browse files
MarstonSalusaSecondus
Marston
authored andcommitted
Allow overriding KMS encryption context.
1 parent 18cf54b commit c2fd000

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

sdk1/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/DirectKmsMaterialProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ protected GenerateDataKeyResult generateDataKey(final GenerateDataKeyRequest req
254254

255255
/**
256256
* Extracts relevant information from {@code context} and uses it to populate fields in
257-
* {@code kmsEc}. Currently, these fields are:
257+
* {@code kmsEc}. Subclass can override the default implementation to provide an alternative
258+
* encryption context in calls to KMS. Currently, the default implementation includes these fields:
258259
* <dl>
259260
* <dt>{@code HashKeyName}</dt>
260261
* <dd>{@code HashKeyValue}</dd>
@@ -263,7 +264,7 @@ protected GenerateDataKeyResult generateDataKey(final GenerateDataKeyRequest req
263264
* <dt>{@link #TABLE_NAME_EC_KEY}</dt>
264265
* <dd>{@code TableName}</dd>
265266
*/
266-
private static void populateKmsEcFromEc(EncryptionContext context, Map<String, String> kmsEc) {
267+
protected void populateKmsEcFromEc(EncryptionContext context, Map<String, String> kmsEc) {
267268
final String hashKeyName = context.getHashKeyName();
268269
if (hashKeyName != null) {
269270
final AttributeValue hashKey = context.getAttributeValues().get(hashKeyName);

sdk2/src/main/java/software/amazon/cryptools/dynamodbencryptionclientsdk2/encryption/providers/DirectKmsMaterialsProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ protected GenerateDataKeyResponse generateDataKey(final GenerateDataKeyRequest r
246246

247247
/**
248248
* Extracts relevant information from {@code context} and uses it to populate fields in
249-
* {@code kmsEc}. Currently, these fields are:
249+
* {@code kmsEc}. Subclass can override the default implementation to provide an alternative
250+
* encryption context in calls to KMS. Currently, the default implementation includes these fields:
250251
* <dl>
251252
* <dt>{@code HashKeyName}</dt>
252253
* <dd>{@code HashKeyValue}</dd>
@@ -255,7 +256,7 @@ protected GenerateDataKeyResponse generateDataKey(final GenerateDataKeyRequest r
255256
* <dt>{@link #TABLE_NAME_EC_KEY}</dt>
256257
* <dd>{@code TableName}</dd>
257258
*/
258-
private static void populateKmsEcFromEc(EncryptionContext context, Map<String, String> kmsEc) {
259+
protected void populateKmsEcFromEc(EncryptionContext context, Map<String, String> kmsEc) {
259260
final String hashKeyName = context.getHashKeyName();
260261
if (hashKeyName != null) {
261262
final AttributeValue hashKey = context.getAttributeValues().get(hashKeyName);

0 commit comments

Comments
 (0)