@@ -14,20 +14,55 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest {
14
14
import EdkWrapping
15
15
import AlgorithmSuites
16
16
17
+ const abc : UTF8. ValidUTF8Bytes :=
18
+ var s := [0x61, 0x62, 0x63];
19
+ assert s == UTF8. EncodeAscii ("abc");
20
+ s
21
+
22
+ const def : UTF8. ValidUTF8Bytes :=
23
+ var s := [0x64, 0x65, 0x66];
24
+ assert s == UTF8. EncodeAscii ("def");
25
+ s
26
+
27
+ const awskms : UTF8. ValidUTF8Bytes :=
28
+ var s := [0x61, 0x77, 0x73, 0x2d, 0x6b, 0x6d, 0x73];
29
+ assert s == UTF8. EncodeAscii ("aws-kms");
30
+ s
31
+
32
+ const keyproviderInfo : UTF8. ValidUTF8Bytes :=
33
+ var s := [0x6b, 0x65, 0x79, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f];
34
+ assert s == UTF8. EncodeAscii ("keyproviderInfo");
35
+ s
36
+
37
+ const aws_kms_hierarchy : UTF8. ValidUTF8Bytes :=
38
+ var s := [0x61, 0x77, 0x73, 0x2d, 0x6b, 0x6d, 0x73, 0x2d, 0x68, 0x69, 0x65, 0x72, 0x61, 0x72, 0x63, 0x68, 0x79];
39
+ assert s == UTF8. EncodeAscii ("aws-kms-hierarchy");
40
+ s
41
+
42
+ const raw_rsa : UTF8. ValidUTF8Bytes :=
43
+ var s := [0x72, 0x61, 0x77, 0x2d, 0x72, 0x73, 0x61];
44
+ assert s == UTF8. EncodeAscii ("raw-rsa");
45
+ s
46
+
47
+ const aws_kms_rsa : UTF8. ValidUTF8Bytes :=
48
+ var s := [0x61, 0x77, 0x73, 0x2d, 0x6b, 0x6d, 0x73, 0x2d, 0x72, 0x73, 0x61];
49
+ assert s == UTF8. EncodeAscii ("aws-kms-rsa");
50
+ s
51
+
17
52
// THIS IS A TESTING RESOURCE DO NOT USE IN A PRODUCTION ENVIRONMENT
18
53
const testVersion : Version := 1
19
54
const testFlavor0 : Flavor := 0
20
55
const testFlavor1 : Flavor := 1
21
56
const testMsgID : MessageID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]
22
57
const testLegend : Legend := [0x65, 0x73]
23
- const testEncContext : CMPEncryptionContext := map [EncodeAscii (" abc") := EncodeAscii (" def") ]
58
+ const testEncContext : CMPEncryptionContext := map [abc := def]
24
59
const testAwsKmsDataKey := CMP. EncryptedDataKey (
25
- keyProviderId := EncodeAscii("aws-kms") ,
26
- keyProviderInfo := EncodeAscii (" keyproviderInfo") ,
60
+ keyProviderId := awskms ,
61
+ keyProviderInfo := keyproviderInfo,
27
62
ciphertext := [1, 2, 3, 4, 5])
28
63
const testAwsKmsHDataKey := CMP. EncryptedDataKey (
29
- keyProviderId := EncodeAscii("aws-kms-hierarchy") ,
30
- keyProviderInfo := EncodeAscii (" keyproviderInfo") ,
64
+ keyProviderId := aws_kms_hierarchy ,
65
+ keyProviderInfo := keyproviderInfo,
31
66
ciphertext := [
32
67
64, 92, 115, 7, 85, 121, 112, 79, 69, 12, 82, 25, 67, 34,
33
68
11, 66, 93, 45, 40, 23, 90, 61, 16, 28, 59, 114, 52, 122,
@@ -40,12 +75,12 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest {
40
75
114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81,
41
76
24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72])
42
77
const testRawRsaDataKey := CMP. EncryptedDataKey (
43
- keyProviderId := EncodeAscii("raw-rsa") ,
78
+ keyProviderId := raw_rsa ,
44
79
keyProviderInfo := [1, 2, 3, 4, 5],
45
80
ciphertext := [6, 7, 8, 9])
46
81
const testAwsKmsRsaDataKey := CMP. EncryptedDataKey (
47
- keyProviderId := EncodeAscii("aws-kms-rsa") ,
48
- keyProviderInfo := EncodeAscii (" keyproviderInfo") ,
82
+ keyProviderId := aws_kms_rsa ,
83
+ keyProviderInfo := keyproviderInfo,
49
84
ciphertext := [1, 2, 3, 4, 5])
50
85
51
86
method CreatePartialHeader (version : Version , flavor : Flavor , msgID : MessageID , legend : Legend , encContext : CMPEncryptionContext , dataKeyList : CMPEncryptedDataKeyList )
0 commit comments