Skip to content

Commit 21f7fe1

Browse files
authored
chore(examples): Shared cache across Hierarchical Keyrings (#1410)
1 parent fe03425 commit 21f7fe1

File tree

7 files changed

+805
-1
lines changed

7 files changed

+805
-1
lines changed

.github/workflows/library_rust_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
id-token: write
2828
contents: read
2929
env:
30-
RUST_MIN_STACK: 104857600
30+
RUST_MIN_STACK: 404857600
3131
steps:
3232
- name: Support longpaths on Git checkout
3333
run: |

Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/keyring/SharedCacheAcrossHierarchicalKeyringsExample.java

+429
Large diffs are not rendered by default.

Examples/runtimes/java/DynamoDbEncryption/src/test/java/software/amazon/cryptography/examples/TestUtils.java

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public class TestUtils {
66
public static final String TEST_LOGICAL_KEYSTORE_NAME = "KeyStoreDdbTable";
77
public static final String TEST_KEYSTORE_KMS_KEY_ID =
88
"arn:aws:kms:us-west-2:370957321024:key/9d989aa2-2f9c-438c-a745-cc57d3ad0126";
9+
public static final String TEST_PARTITION_ID =
10+
"91c1b6a2-6fc3-4539-ad5e-938d597ed730";
911

1012
public static final String TEST_AWS_ACCOUNT_ID = "658956600833";
1113
public static final String TEST_AWS_REGION = "us-west-2";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package software.amazon.cryptography.examples.keyring;
2+
3+
import org.testng.annotations.Test;
4+
import software.amazon.cryptography.examples.CreateKeyStoreKeyExample;
5+
import software.amazon.cryptography.examples.TestUtils;
6+
7+
public class TestSharedCacheAcrossHierarchicalKeyringsExample {
8+
9+
@Test
10+
public void TestSharedCacheAcrossHierarchicalKeyringsExample()
11+
throws InterruptedException {
12+
// Create new branch key for test
13+
String keyId = CreateKeyStoreKeyExample.KeyStoreCreateKey(
14+
TestUtils.TEST_KEYSTORE_NAME,
15+
TestUtils.TEST_LOGICAL_KEYSTORE_NAME,
16+
TestUtils.TEST_KEYSTORE_KMS_KEY_ID
17+
);
18+
19+
// Key creation is eventually consistent, so wait 5 seconds to decrease the likelihood
20+
// our test fails due to eventual consistency issues.
21+
Thread.sleep(5000);
22+
23+
SharedCacheAcrossHierarchicalKeyringsExample.SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
24+
TestUtils.TEST_DDB_TABLE_NAME,
25+
keyId,
26+
TestUtils.TEST_KEYSTORE_NAME,
27+
TestUtils.TEST_LOGICAL_KEYSTORE_NAME,
28+
TestUtils.TEST_PARTITION_ID,
29+
TestUtils.TEST_KEYSTORE_KMS_KEY_ID
30+
);
31+
}
32+
}

Examples/runtimes/net/src/Examples.cs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static async Task Main()
3333
Thread.Sleep(5000);
3434

3535
await HierarchicalKeyringExample.HierarchicalKeyringGetItemPutItem(keyId, keyId2);
36+
await SharedCacheAcrossHierarchicalKeyringsExample.SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(keyId);
3637

3738
await BasicSearchableEncryptionExample.PutItemQueryItemWithBeacon(keyId);
3839
await CompoundBeaconSearchableEncryptionExample.PutItemQueryItemWithCompoundBeacon(keyId);

Examples/runtimes/net/src/TestUtils.cs

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ public class TestUtils
77
public static readonly string TEST_KEYSTORE_NAME = "KeyStoreDdbTable";
88
public static readonly string TEST_LOGICAL_KEYSTORE_NAME = "KeyStoreDdbTable";
99

10+
public static readonly string TEST_PARTITION_ID = "91c1b6a2-6fc3-4539-ad5e-938d597ed730";
11+
1012
public static readonly string TEST_KEYSTORE_KMS_KEY_ID =
1113
"arn:aws:kms:us-west-2:370957321024:key/9d989aa2-2f9c-438c-a745-cc57d3ad0126";
1214

Examples/runtimes/net/src/keyring/SharedCacheAcrossHierarchicalKeyringsExample.cs

+338
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)