-
-
Notifications
You must be signed in to change notification settings - Fork 544
/
canonical-data.json
98 lines (98 loc) · 3.48 KB
/
canonical-data.json
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
"exercise": "diffie-hellman",
"comments": [
"Optional tests to consider: ",
" ",
"* Validation of parameters: ",
" - Validate that `p`, `g` are valid. ",
" - Validate that keys given as inputs are valid. ",
" Resources that show what happens if parameters are not validated: ",
" https://cryptopals.com/sets/5/challenges/34 ",
" https://cryptopals.com/sets/5/challenges/35 ",
" ",
"* Large numbers: ",
" Although the calculations fundamentally do not require large numbers, ",
" this is a reasonable real-world use for them and it may be instructive ",
" to have an exercise on their use. Consult tracks with this exercise ",
" (such as the Go track) for possible inputs to use. "
],
"cases": [
{
"uuid": "1b97bf38-4307-418e-bfd2-446ffc77588d",
"description": "private key is greater than 1 and less than p",
"scenarios": ["random"],
"property": "privateKeyIsInRange",
"input": {},
"expected": {
"greaterThan": 1,
"lessThan": "p"
}
},
{
"uuid": "68b2a5f7-7755-44c3-97b2-d28d21f014a9",
"description": "private key is random",
"scenarios": ["random"],
"property": "privateKeyIsRandom",
"input": {},
"expected": {
"random": true
}
},
{
"uuid": "b4161d8e-53a1-4241-ae8f-48cc86527f22",
"description": "can calculate public key using private key",
"property": "publicKey",
"input": {
"p": 23,
"g": 5,
"privateKey": 6
},
"expected": 8
},
{
"uuid": "0d25f8d7-4897-4338-a033-2d3d7a9af688",
"description": "can calculate public key when given a different private key",
"comments": [
"As this test is intended to test the immutability / purity ",
"of the underlying structure, when implemented, it should first get a ",
"public key from different values, for example from the test with ",
"uuid (b4161d8e-53a1-4241-ae8f-48cc86527f22). "
],
"scenarios": ["immutable"],
"property": "publicKey",
"input": {
"p": 23,
"g": 5,
"privateKey": 15
},
"expected": 19
},
{
"uuid": "cd02ad45-3f52-4510-99cc-5161dad948a8",
"description": "can calculate secret using other party's public key",
"property": "secret",
"input": {
"p": 23,
"theirPublicKey": 19,
"myPrivateKey": 6
},
"expected": 2
},
{
"uuid": "17f13c61-a111-4075-9a1f-c2d4636dfa60",
"description": "key exchange",
"property": "keyExchange",
"input": {
"p": 23,
"g": 5,
"alicePrivateKey": "privateKey(p)",
"bobPrivateKey": "privateKey(p)",
"alicePublicKey": "publicKey(p, g, alicePrivateKey)",
"bobPublicKey": "publicKey(p, g, bobPrivateKey)",
"secretA": "secret(p, bobPublicKey, alicePrivateKey)",
"secretB": "secret(p, alicePublicKey, bobPrivateKey)"
},
"expected": "secretA == secretB"
}
]
}