@@ -180,7 +180,7 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
180
180
final IKeyring hierarchicalKeyring1 =
181
181
matProv .CreateAwsKmsHierarchicalKeyring (keyringInput1 );
182
182
183
- // 4 . Configure which attributes are encrypted and/or signed when writing new items.
183
+ // 5 . Configure which attributes are encrypted and/or signed when writing new items.
184
184
// For each attribute that may exist on the items we plan to write to our DynamoDbTable,
185
185
// we must explicitly configure how they should be treated during item encryption:
186
186
// - ENCRYPT_AND_SIGN: The attribute is encrypted and included in the signature
@@ -194,14 +194,14 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
194
194
CryptoAction .ENCRYPT_AND_SIGN
195
195
);
196
196
197
- // 5 . Get the DDB Client for Hierarchical Keyring 1.
197
+ // 6 . Get the DDB Client for Hierarchical Keyring 1.
198
198
final DynamoDbClient ddbClient1 = GetDdbClient (
199
199
ddbTableName ,
200
200
hierarchicalKeyring1 ,
201
201
attributeActionsOnEncrypt
202
202
);
203
203
204
- // 6 . Encrypt Decrypt roundtrip with ddbClient1
204
+ // 7 . Encrypt Decrypt roundtrip with ddbClient1
205
205
PutGetItems (ddbTableName , ddbClient1 );
206
206
207
207
// Through the above encrypt and decrypt roundtrip, the cache will be populated and
@@ -210,7 +210,7 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
210
210
// - Same Logical Key Store Name of the Key Store for the Hierarchical Keyring
211
211
// - Same Branch Key ID
212
212
213
- // 7 . Configure your KeyStore resource keystore2.
213
+ // 8 . Configure your KeyStore resource keystore2.
214
214
// This SHOULD be the same configuration that you used
215
215
// to initially create and populate your physical KeyStore.
216
216
// Note that keyStoreTableName is the physical Key Store,
@@ -243,13 +243,13 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
243
243
)
244
244
.build ();
245
245
246
- // 8 . Create the Hierarchical Keyring HK2 with Key Store instance K2, the shared Cache
246
+ // 9 . Create the Hierarchical Keyring HK2 with Key Store instance K2, the shared Cache
247
247
// and the same partitionId and BranchKeyId used in HK1 because we want to share cache entries
248
248
// (and experience cache HITS).
249
249
250
- // Please make sure that you read the guidance on how to set Partition ID, Logical Key Store Name and
251
- // Branch Key ID at the top of this example before creating Hierarchical Keyrings with a Shared Cache.
252
- // partitionId for this example is a random UUID
250
+ Please make sure that you read the guidance on how to set Partition ID , Logical Key Store Name and
251
+ Branch Key ID at the top of this example before creating Hierarchical Keyrings with a Shared Cache .
252
+ partitionId for this example is a random UUID
253
253
final CreateAwsKmsHierarchicalKeyringInput keyringInput2 =
254
254
CreateAwsKmsHierarchicalKeyringInput
255
255
.builder ()
@@ -262,14 +262,14 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
262
262
final IKeyring hierarchicalKeyring2 =
263
263
matProv .CreateAwsKmsHierarchicalKeyring (keyringInput2 );
264
264
265
- // 9 . Get the DDB Client for Hierarchical Keyring 2.
265
+ // 10 . Get the DDB Client for Hierarchical Keyring 2.
266
266
final DynamoDbClient ddbClient2 = GetDdbClient (
267
267
ddbTableName ,
268
268
hierarchicalKeyring2 ,
269
269
attributeActionsOnEncrypt
270
270
);
271
271
272
- // 10 . Encrypt Decrypt roundtrip with ddbClient2
272
+ // 11 . Encrypt Decrypt roundtrip with ddbClient2
273
273
PutGetItems (ddbTableName , ddbClient2 );
274
274
}
275
275
@@ -352,12 +352,12 @@ public static void PutGetItems(
352
352
String ddbTableName ,
353
353
DynamoDbClient ddbClient
354
354
) {
355
- // Put an item into our table using the given ddb client.
356
- // Before the item gets sent to DynamoDb, it will be encrypted
357
- // client-side, according to our configuration.
358
- // This example creates a Hierarchical Keyring for a single BranchKeyId. You can, however, use a
359
- // BranchKeyIdSupplier as per your use-case. See the HierarchicalKeyringsExample.java for more
360
- // information.
355
+ Put an item into our table using the given ddb client .
356
+ Before the item gets sent to DynamoDb , it will be encrypted
357
+ client -side , according to our configuration .
358
+ This example creates a Hierarchical Keyring for a single BranchKeyId . You can , however , use a
359
+ BranchKeyIdSupplier as per your use -case . See the HierarchicalKeyringsExample .java for more
360
+ information .
361
361
final HashMap <String , AttributeValue > item = new HashMap <>();
362
362
item .put ("partition_key" , AttributeValue .builder ().s ("id" ).build ());
363
363
item .put ("sort_key" , AttributeValue .builder ().n ("0" ).build ());
@@ -377,12 +377,12 @@ public static void PutGetItems(
377
377
// Demonstrate that PutItem succeeded
378
378
assert 200 == putResponse .sdkHttpResponse ().statusCode ();
379
379
380
- // Get the item back from our table using the same client.
381
- // The client will decrypt the item client-side, and return
382
- // back the original item.
383
- // This example creates a Hierarchical Keyring for a single BranchKeyId. You can, however, use a
384
- // BranchKeyIdSupplier as per your use-case. See the HierarchicalKeyringsExample.java for more
385
- // information.
380
+ Get the item back from our table using the same client .
381
+ The client will decrypt the item client -side , and return
382
+ back the original item .
383
+ This example creates a Hierarchical Keyring for a single BranchKeyId . You can , however , use a
384
+ BranchKeyIdSupplier as per your use -case . See the HierarchicalKeyringsExample .java for more
385
+ information .
386
386
final HashMap <String , AttributeValue > keyToGet = new HashMap <>();
387
387
keyToGet .put ("partition_key" , AttributeValue .builder ().s ("id" ).build ());
388
388
keyToGet .put ("sort_key" , AttributeValue .builder ().n ("0" ).build ());
0 commit comments