Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4017a97

Browse files
chore(TestVectors): add config tests for new attributes (#1967)
1 parent 139c856 commit 4017a97

File tree

3 files changed

+255892
-1
lines changed

3 files changed

+255892
-1
lines changed

‎TestVectors/dafny/DDBEncryption/src/TestVectors.dfy‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
104104
var _ :- expect DecryptManifest.Decrypt("decrypt_java_33a.json", keyVectors);
105105
var _ :- expect DecryptManifest.Decrypt("decrypt_rust_38.json", keyVectors);
106106
var _ :- expect DecryptManifest.Decrypt("decrypt_go_38.json", keyVectors);
107+
var _ :- expect DecryptManifest.Decrypt("decrypt_java_39.json", keyVectors);
107108
var _ :- expect WriteManifest.Write("encrypt.json");
108109
var _ :- expect EncryptManifest.Encrypt("encrypt.json", "decrypt.json", "java", "3.3", keyVectors);
109110
var _ :- expect DecryptManifest.Decrypt("decrypt.json", keyVectors);

‎TestVectors/dafny/DDBEncryption/src/WriteManifest.dfy‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,34 @@ module {:options "-functionSyntax:4"} WriteManifest {
127127
},
128128
""allowedUnsignedAttributes"" : [""Stuff"", ""Junk""]
129129
}"
130+
// Configuration with a new encrypted attribute not present in basic config
131+
const ExpandedBasicConfig := @"{
132+
""attributeActionsOnEncrypt"": {
133+
""RecNum"": ""SIGN_ONLY"",
134+
""Stuff"": ""ENCRYPT_AND_SIGN"",
135+
""Junk"": ""ENCRYPT_AND_SIGN"",
136+
""NewThing"": ""ENCRYPT_AND_SIGN""
137+
}
138+
}"
139+
// Configuration with a new sign-only attribute not present in basic config
140+
const ExpandedSignConfig := @"{
141+
""attributeActionsOnEncrypt"": {
142+
""RecNum"": ""SIGN_ONLY"",
143+
""Stuff"": ""ENCRYPT_AND_SIGN"",
144+
""Junk"": ""ENCRYPT_AND_SIGN"",
145+
""NewThing"": ""SIGN_ONLY""
146+
}
147+
}"
148+
// Configuration with a new DO_NOTHING attribute not present in basic config
149+
const ExpandedDoNothingConfig := @"{
150+
""attributeActionsOnEncrypt"": {
151+
""RecNum"": ""SIGN_ONLY"",
152+
""Stuff"": ""ENCRYPT_AND_SIGN"",
153+
""Junk"": ""ENCRYPT_AND_SIGN"",
154+
""NewThing"": ""DO_NOTHING""
155+
},
156+
""allowedUnsignedAttributes"": [""NewThing""]
157+
}"
130158

131159
method TextToJson(x: string) returns (output : JSON)
132160
{
@@ -396,8 +424,16 @@ module {:options "-functionSyntax:4"} WriteManifest {
396424
var test12 := MakeTest("12", "positive-encrypt", "Basic encrypt V2 switching1", LongerV2Config1, BasicRecord, Some(LongerV2Config2));
397425
var test13 := MakeTest("13", "positive-encrypt", "Basic encrypt V2 switching2", LongerV2Config2, BasicRecord, Some(LongerV2Config1));
398426
var test14 := MakeTest("14", "positive-encrypt", "Special characters in attribute names", SpecialConfig, SpecialRecord);
427+
428+
var test15 := MakeTest("15", "positive-encrypt", "Add new ENCRYPT_AND_SIGN attribute", BasicConfig, BasicRecord, Some(ExpandedBasicConfig));
429+
var test16 := MakeTest("16", "positive-encrypt", "Add new SIGN_ONLY attribute", BasicConfig, BasicRecord, Some(ExpandedSignConfig));
430+
var test17 := MakeTest("17", "positive-encrypt", "Add new DO_NOTHING attribute", BasicConfig, BasicRecord, Some(ExpandedDoNothingConfig));
431+
var test18 := MakeTest("18", "positive-encrypt", "Remove ENCRYPT_AND_SIGN attribute, encrypt with expanded, decrypt with basic", ExpandedBasicConfig, BasicRecord, Some(BasicConfig));
432+
var test19 := MakeTest("19", "positive-encrypt", "Remove SIGN_ONLY attribute, encrypt with expanded, decrypt with basic", ExpandedSignConfig, BasicRecord, Some(BasicConfig));
433+
var test20 := MakeTest("20", "positive-encrypt", "Remove DO_NOTHING attribute, encrypt with expanded, decrypt with basic", ExpandedDoNothingConfig, BasicRecord, Some(BasicConfig));
434+
399435
var configTests := MakeConfigTests();
400-
var tests : seq<(string, JSON)> := [test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, test11, test12, test13, test14] + configTests;
436+
var tests : seq<(string, JSON)> := [test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, test11, test12, test13, test14, test15, test16, test17, test18, test19, test20] + configTests;
401437
var final := Object(result + [("tests", Object(tests))]);
402438

403439
var jsonBytes :- expect API.Serialize(final);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /