@@ -24,39 +24,39 @@ module CompoundBeacon {
24
24
type Prefix = x : string | 0 < |x| witness *
25
25
26
26
datatype BeaconPart =
27
- | Sensitive (prefix : Prefix , beacon : BaseBeacon .StandardBeacon)
28
- | NonSensitive (prefix : Prefix , name : string , loc : TermLoc )
27
+ | Encrypted (prefix : Prefix , beacon : BaseBeacon .StandardBeacon)
28
+ | Signed (prefix : Prefix , name : string , loc : TermLoc )
29
29
{
30
30
31
31
function method getPrefix () : string
32
32
{
33
33
match this {
34
- case Sensitive (p, b) => p
35
- case NonSensitive (p, n, l) => p
34
+ case Encrypted (p, b) => p
35
+ case Signed (p, n, l) => p
36
36
}
37
37
}
38
38
39
39
function method getName () : string
40
40
{
41
41
match this {
42
- case Sensitive (p, b) => b. base. name
43
- case NonSensitive (p, n, l) => n
42
+ case Encrypted (p, b) => b. base. name
43
+ case Signed (p, n, l) => n
44
44
}
45
45
}
46
46
47
47
function method getString (item : DDB .AttributeMap, vf : VirtualFieldMap ) : Result< Option< string > , Error>
48
48
{
49
49
match this {
50
- case Sensitive (p, b) => VirtToString (b.loc, item, vf)
51
- case NonSensitive (p, n, l) => VirtToString (l, item, vf)
50
+ case Encrypted (p, b) => VirtToString (b.loc, item, vf)
51
+ case Signed (p, n, l) => VirtToString (l, item, vf)
52
52
}
53
53
}
54
54
55
55
function method GetFields (virtualFields : VirtualFieldMap ) : seq < string >
56
56
{
57
57
match this {
58
- case Sensitive (p, b) => b. GetFields (virtualFields)
59
- case NonSensitive (p, n, l) =>
58
+ case Encrypted (p, b) => b. GetFields (virtualFields)
59
+ case Signed (p, n, l) =>
60
60
if loc[0]. key in virtualFields then
61
61
virtualFields[loc[0]. key]. GetFields ()
62
62
else
@@ -88,47 +88,47 @@ module CompoundBeacon {
88
88
function method MakeCompoundBeacon (
89
89
base : BeaconBase ,
90
90
split : char ,
91
- parts : seq <BeaconPart >, // Non-Sensitive followed by Sensitive
92
- numNonSensitive : nat ,
91
+ parts : seq <BeaconPart >, // Signed followed by Encrypted
92
+ numSigned : nat ,
93
93
construct : ConstructorList
94
94
)
95
95
: (ret : Result< ValidCompoundBeacon, Error> )
96
- requires numNonSensitive <= |parts|
97
- requires OrderedParts (parts, numNonSensitive )
96
+ requires numSigned <= |parts|
97
+ requires OrderedParts (parts, numSigned )
98
98
99
99
// = specification/searchable-encryption/beacons.md#initialization-failure
100
100
// = type=implication
101
101
// # Initialization MUST fail if any `prefix` in any [part](#part) is a prefix of
102
102
// # the `prefix` of any other [part](#part).
103
103
ensures ret. Success? ==> ret. value. ValidPrefixSet ()
104
104
{
105
- var x := CompoundBeacon. CompoundBeacon (base, split, parts, numNonSensitive , construct);
105
+ var x := CompoundBeacon. CompoundBeacon (base, split, parts, numSigned , construct);
106
106
var _ :- x. ValidPrefixSetResult ();
107
107
Success (x)
108
108
}
109
109
110
110
// are the parts properly ordered?
111
- // that is, with the non-sensitive parts followed the sensitive parts
111
+ // that is, with the signed parts followed the encrypted parts
112
112
predicate OrderedParts (p : seq <BeaconPart >, n : nat )
113
113
requires n <= |p|
114
114
{
115
- && (forall x | 0 <= x < n :: p[x]. NonSensitive ?)
116
- && (forall x | n <= x < |p| :: p[x]. Sensitive ?)
115
+ && (forall x | 0 <= x < n :: p[x]. Signed ?)
116
+ && (forall x | n <= x < |p| :: p[x]. Encrypted ?)
117
117
}
118
118
119
119
datatype CompoundBeacon = CompoundBeacon (
120
120
base : BeaconBase ,
121
121
split : char ,
122
122
parts : seq <BeaconPart >,
123
- numNonSensitive : nat ,
123
+ numSigned : nat ,
124
124
construct : ConstructorList
125
125
) {
126
126
127
127
predicate ValidState ()
128
128
{
129
129
&& ValidPrefixSet ()
130
- && numNonSensitive <= |parts|
131
- && OrderedParts (parts, numNonSensitive )
130
+ && numSigned <= |parts|
131
+ && OrderedParts (parts, numSigned )
132
132
}
133
133
134
134
// no prefix is a prefix of another prefix
@@ -140,9 +140,9 @@ module CompoundBeacon {
140
140
:: OkPrefixPair (x, y)
141
141
}
142
142
143
- // Does this beacon have any sensitive parts
143
+ // Does this beacon have any encrypted parts
144
144
predicate method isEncrypted () {
145
- numNonSensitive < |parts|
145
+ numSigned < |parts|
146
146
}
147
147
148
148
// find the part whose prefix matches this value
@@ -166,14 +166,14 @@ module CompoundBeacon {
166
166
partFromPrefix (p[1..], value)
167
167
}
168
168
169
- // trim leading pieces that refer to nonsensitive parts
169
+ // trim leading pieces that refer to signed parts
170
170
function method SkipSignedPieces (pieces : seq <string >) : Result< seq < string > , Error>
171
171
{
172
172
if |pieces| == 0 then
173
173
Success (pieces)
174
174
else
175
175
var p :- partFromPrefix (parts, pieces[0]);
176
- if p. Sensitive ? then
176
+ if p. Encrypted ? then
177
177
Success (pieces)
178
178
else
179
179
SkipSignedPieces (pieces[1..])
@@ -477,9 +477,9 @@ module CompoundBeacon {
477
477
478
478
// = specification/searchable-encryption/beacons.md#part-value-calculation
479
479
// = type=implication
480
- // # If the part is a [nonsensitive part](#non-sensitive -part-initialization),
480
+ // # If the part is a [signed part](#signed -part-initialization),
481
481
// # the part value MUST be the concatenation of the part's prefix and the input string.
482
- ensures part. NonSensitive ? && ret. Success? ==>
482
+ ensures part. Signed ? && ret. Success? ==>
483
483
&& ret. value == part. prefix + data
484
484
&& 0 < |ret. value|
485
485
// = specification/searchable-encryption/beacons.md#value-for-a-compound-beacon
@@ -489,10 +489,10 @@ module CompoundBeacon {
489
489
490
490
// = specification/searchable-encryption/beacons.md#part-value-calculation
491
491
// = type=implication
492
- // # If the part is a [sensitive part](#sensitive -part-initialization),
492
+ // # If the part is a [encrypted part](#encrypted -part-initialization),
493
493
// # the part value MUST be the concatenation of the part's prefix
494
494
// # and the [string hash](#string-hash) of the input string.
495
- ensures part. Sensitive ? && ret. Success? ==>
495
+ ensures part. Encrypted ? && ret. Success? ==>
496
496
&& 0 < |ret. value|
497
497
&& keys. Keys?
498
498
&& part. beacon. hashStr (data, keys.value). Success?
@@ -504,11 +504,11 @@ module CompoundBeacon {
504
504
{
505
505
:- Need (split !in data, E("Value '" + data + "' for beacon part " + part.getName() + " contains the split character '" + [split] + "'. "));
506
506
match part {
507
- case Sensitive (p, b) =>
507
+ case Encrypted (p, b) =>
508
508
:- Need (keys.Keys?, E("Need KeyId for beacon " + b.base.name + " but no KeyId found in query."));
509
509
var hash :- b. hashStr (data, keys.value);
510
510
Success (part.prefix + hash)
511
- case NonSensitive =>
511
+ case Signed =>
512
512
Success (part.prefix + data)
513
513
}
514
514
}
0 commit comments