|
65 | 65 | * - Same Branch Key ID |
66 | 66 | * then they WILL share the cache entries in the Shared Cache. |
67 | 67 | * Please make sure that you set all of Partition ID, Logical Key Store Name and Branch Key ID |
68 | | - * to be the same for two Hierarchical Keyrings only if you want them to share cache entries. |
| 68 | + * to be the same for two Hierarchical Keyrings if and only if you want them to share cache entries. |
69 | 69 | * |
70 | 70 | * <p>This example first creates a shared cache that you can use across multiple Hierarchical Keyrings. |
71 | 71 | * The example then configures a Hierarchical Keyring (HK1 and HK2) with the shared cache, |
|
80 | 80 | * table must be configured with the following primary key configuration: - Partition key is named |
81 | 81 | * "partition_key" with type (S) - Sort key is named "sort_key" with type (S) |
82 | 82 | * |
83 | | - * <p>This example also requires using a KMS Key. You need the following access on this key: - |
84 | | - * GenerateDataKeyWithoutPlaintext - Decrypt |
| 83 | + * <p>This example also requires using a KMS Key. You need the following access on this key: |
| 84 | + * - GenerateDataKeyWithoutPlaintext |
| 85 | + * - Decrypt |
85 | 86 | */ |
86 | 87 | public class SharedCacheAcrossHierarchicalKeyringsExample { |
87 | 88 | private static final byte[] EXAMPLE_DATA = "Hello World".getBytes(StandardCharsets.UTF_8); |
@@ -204,16 +205,16 @@ public static void encryptAndDecryptWithKeyring( |
204 | 205 | // HK1 (which uses Key Store instance K1) and HK2 (which uses Key Store |
205 | 206 | // instance K2) will NOT be able to share cache entries. |
206 | 207 | final KeyStore keystore2 = |
207 | | - KeyStore.builder() |
208 | | - .KeyStoreConfig( |
209 | | - KeyStoreConfig.builder() |
210 | | - .ddbClient(DynamoDbClient.create()) |
211 | | - .ddbTableName(keyStoreTableName) |
212 | | - .logicalKeyStoreName(logicalKeyStoreName) |
213 | | - .kmsClient(KmsClient.create()) |
214 | | - .kmsConfiguration(KMSConfiguration.builder().kmsKeyArn(kmsKeyId).build()) |
215 | | - .build()) |
216 | | - .build(); |
| 208 | + KeyStore.builder() |
| 209 | + .KeyStoreConfig( |
| 210 | + KeyStoreConfig.builder() |
| 211 | + .ddbClient(DynamoDbClient.create()) |
| 212 | + .ddbTableName(keyStoreTableName) |
| 213 | + .logicalKeyStoreName(logicalKeyStoreName) |
| 214 | + .kmsClient(KmsClient.create()) |
| 215 | + .kmsConfiguration(KMSConfiguration.builder().kmsKeyArn(kmsKeyId).build()) |
| 216 | + .build()) |
| 217 | + .build(); |
217 | 218 |
|
218 | 219 | // Create the Hierarchical Keyring HK2 with Key Store instance K2, the shared Cache |
219 | 220 | // and the same partitionId and BranchKeyId used in HK1 because we want to share cache entries |
|
0 commit comments