Skip to content

Commit d4a0424

Browse files
authored
feat: rename sensitive to encrypted and nonsensitive to signed (#175)
1 parent 85a0b19 commit d4a0424

File tree

21 files changed

+417
-417
lines changed

21 files changed

+417
-417
lines changed

DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
4949
datatype CompoundBeacon = | CompoundBeacon (
5050
nameonly name: string ,
5151
nameonly split: Char ,
52-
nameonly sensitive: Option<SensitivePartsList> ,
53-
nameonly nonSensitive: Option<NonSensitivePartsList> ,
52+
nameonly encrypted: Option<EncryptedPartsList> ,
53+
nameonly signed: Option<SignedPartsList> ,
5454
nameonly constructors: Option<ConstructorList>
5555
)
5656
type CompoundBeaconList = x: seq<CompoundBeacon> | IsValid_CompoundBeaconList(x) witness *
@@ -222,6 +222,14 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
222222
datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig (
223223
nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList
224224
)
225+
datatype EncryptedPart = | EncryptedPart (
226+
nameonly name: string ,
227+
nameonly prefix: Prefix
228+
)
229+
type EncryptedPartsList = x: seq<EncryptedPart> | IsValid_EncryptedPartsList(x) witness *
230+
predicate method IsValid_EncryptedPartsList(x: seq<EncryptedPart>) {
231+
( 1 <= |x| )
232+
}
225233
datatype GetBranchKeyIdFromDdbKeyInput = | GetBranchKeyIdFromDdbKeyInput (
226234
nameonly ddbKey: ComAmazonawsDynamodbTypes.Key
227235
)
@@ -303,15 +311,6 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
303311
nameonly cacheTTL: int32 ,
304312
nameonly maxCacheSize: int32
305313
)
306-
datatype NonSensitivePart = | NonSensitivePart (
307-
nameonly name: string ,
308-
nameonly prefix: Prefix ,
309-
nameonly loc: Option<TerminalLocation>
310-
)
311-
type NonSensitivePartsList = x: seq<NonSensitivePart> | IsValid_NonSensitivePartsList(x) witness *
312-
predicate method IsValid_NonSensitivePartsList(x: seq<NonSensitivePart>) {
313-
( 1 <= |x| )
314-
}
315314
datatype PlaintextPolicy =
316315
| REQUIRE_WRITE_ALLOW_READ
317316
| FORBID_WRITE_ALLOW_READ
@@ -324,12 +323,13 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
324323
nameonly versions: BeaconVersionList ,
325324
nameonly writeVersion: VersionNumber
326325
)
327-
datatype SensitivePart = | SensitivePart (
326+
datatype SignedPart = | SignedPart (
328327
nameonly name: string ,
329-
nameonly prefix: Prefix
328+
nameonly prefix: Prefix ,
329+
nameonly loc: Option<TerminalLocation>
330330
)
331-
type SensitivePartsList = x: seq<SensitivePart> | IsValid_SensitivePartsList(x) witness *
332-
predicate method IsValid_SensitivePartsList(x: seq<SensitivePart>) {
331+
type SignedPartsList = x: seq<SignedPart> | IsValid_SignedPartsList(x) witness *
332+
predicate method IsValid_SignedPartsList(x: seq<SignedPart>) {
333333
( 1 <= |x| )
334334
}
335335
datatype SingleKeyStore = | SingleKeyStore (

DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ list CompoundBeaconList {
244244
}
245245

246246
@length(min: 1)
247-
list SensitivePartsList {
248-
member: SensitivePart
247+
list EncryptedPartsList {
248+
member: EncryptedPart
249249
}
250250

251251
@length(min: 1)
252-
list NonSensitivePartsList {
253-
member: NonSensitivePart
252+
list SignedPartsList {
253+
member: SignedPart
254254
}
255255

256256
@length(min: 1)
@@ -422,31 +422,31 @@ union VirtualTransform {
422422
segments : GetSegments
423423
}
424424

425-
//= specification/searchable-encryption/beacons.md#sensitive-part-initialization
425+
//= specification/searchable-encryption/beacons.md#encrypted-part-initialization
426426
//= type=implication
427-
//# On initialization of a [sensitive part](#sensitive-part-initialization), the caller MUST provide:
427+
//# On initialization of a [encrypted part](#encrypted-part-initialization), the caller MUST provide:
428428
//# * A name -- a string, the name of a standard beacon
429429
//# * A prefix -- a string
430430

431-
structure SensitivePart {
431+
structure EncryptedPart {
432432
@required
433433
name : String,
434434
@required
435435
prefix : Prefix
436436
}
437437

438-
//= specification/searchable-encryption/beacons.md#non-sensitive-part-initialization
438+
//= specification/searchable-encryption/beacons.md#signed-part-initialization
439439
//= type=implication
440-
//# On initialization of a [non-sensitive part](#non-sensitive-part-initialization), the caller MUST provide:
440+
//# On initialization of a [signed part](#signed-part-initialization), the caller MUST provide:
441441
//# * A name -- a string
442442
//# * A prefix -- a string
443443

444-
//= specification/searchable-encryption/beacons.md#non-sensitive-part-initialization
444+
//= specification/searchable-encryption/beacons.md#signed-part-initialization
445445
//= type=implication
446-
//# On initialization of a [non-sensitive parts](#non-sensitive-part-initialization), the caller MAY provide:
446+
//# On initialization of a [signed parts](#signed-part-initialization), the caller MAY provide:
447447
//# * A [terminal location](virtual.md#terminal-location) -- a string
448448

449-
structure NonSensitivePart {
449+
structure SignedPart {
450450
@required
451451
name : String,
452452
@required
@@ -505,17 +505,17 @@ structure StandardBeacon {
505505
//= specification/searchable-encryption/beacons.md#compound-beacon-initialization
506506
//= type=implication
507507
//# On initialization of a Compound Beacon, the caller MAY provide:
508-
//# * A list of [sensitive parts](#sensitive-part-initialization)
509-
//# * A list of [non-sensitive parts](#non-sensitive-part-initialization)
508+
//# * A list of [encrypted parts](#encrypted-part-initialization)
509+
//# * A list of [signed parts](#signed-part-initialization)
510510
//# * A list of constructors
511511

512512
structure CompoundBeacon {
513513
@required
514514
name : String,
515515
@required
516516
split : Char,
517-
sensitive : SensitivePartsList,
518-
nonSensitive : NonSensitivePartsList,
517+
encrypted : EncryptedPartsList,
518+
signed : SignedPartsList,
519519
constructors : ConstructorList
520520
}
521521

DynamoDbEncryption/dafny/DynamoDbEncryption/src/CompoundBeacon.dfy

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,39 @@ module CompoundBeacon {
2424
type Prefix = x : string | 0 < |x| witness *
2525

2626
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)
2929
{
3030

3131
function method getPrefix() : string
3232
{
3333
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
3636
}
3737
}
3838

3939
function method getName() : string
4040
{
4141
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
4444
}
4545
}
4646

4747
function method getString(item : DDB.AttributeMap, vf : VirtualFieldMap) : Result<Option<string>, Error>
4848
{
4949
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)
5252
}
5353
}
5454

5555
function method GetFields(virtualFields : VirtualFieldMap) : seq<string>
5656
{
5757
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) =>
6060
if loc[0].key in virtualFields then
6161
virtualFields[loc[0].key].GetFields()
6262
else
@@ -88,47 +88,47 @@ module CompoundBeacon {
8888
function method MakeCompoundBeacon(
8989
base : BeaconBase,
9090
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,
9393
construct : ConstructorList
9494
)
9595
: (ret : Result<ValidCompoundBeacon, Error>)
96-
requires numNonSensitive <= |parts|
97-
requires OrderedParts(parts, numNonSensitive)
96+
requires numSigned <= |parts|
97+
requires OrderedParts(parts, numSigned)
9898

9999
//= specification/searchable-encryption/beacons.md#initialization-failure
100100
//= type=implication
101101
//# Initialization MUST fail if any `prefix` in any [part](#part) is a prefix of
102102
//# the `prefix` of any other [part](#part).
103103
ensures ret.Success? ==> ret.value.ValidPrefixSet()
104104
{
105-
var x := CompoundBeacon.CompoundBeacon(base, split, parts, numNonSensitive, construct);
105+
var x := CompoundBeacon.CompoundBeacon(base, split, parts, numSigned, construct);
106106
var _ :- x.ValidPrefixSetResult();
107107
Success(x)
108108
}
109109

110110
// 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
112112
predicate OrderedParts(p : seq<BeaconPart>, n : nat)
113113
requires n <= |p|
114114
{
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?)
117117
}
118118

119119
datatype CompoundBeacon = CompoundBeacon(
120120
base : BeaconBase,
121121
split : char,
122122
parts : seq<BeaconPart>,
123-
numNonSensitive : nat,
123+
numSigned : nat,
124124
construct : ConstructorList
125125
) {
126126

127127
predicate ValidState()
128128
{
129129
&& ValidPrefixSet()
130-
&& numNonSensitive <= |parts|
131-
&& OrderedParts(parts, numNonSensitive)
130+
&& numSigned <= |parts|
131+
&& OrderedParts(parts, numSigned)
132132
}
133133

134134
// no prefix is a prefix of another prefix
@@ -140,9 +140,9 @@ module CompoundBeacon {
140140
:: OkPrefixPair(x, y)
141141
}
142142

143-
// Does this beacon have any sensitive parts
143+
// Does this beacon have any encrypted parts
144144
predicate method isEncrypted() {
145-
numNonSensitive < |parts|
145+
numSigned < |parts|
146146
}
147147

148148
// find the part whose prefix matches this value
@@ -166,14 +166,14 @@ module CompoundBeacon {
166166
partFromPrefix(p[1..], value)
167167
}
168168

169-
// trim leading pieces that refer to nonsensitive parts
169+
// trim leading pieces that refer to signed parts
170170
function method SkipSignedPieces(pieces : seq<string>) : Result<seq<string>, Error>
171171
{
172172
if |pieces| == 0 then
173173
Success(pieces)
174174
else
175175
var p :- partFromPrefix(parts, pieces[0]);
176-
if p.Sensitive? then
176+
if p.Encrypted? then
177177
Success(pieces)
178178
else
179179
SkipSignedPieces(pieces[1..])
@@ -477,9 +477,9 @@ module CompoundBeacon {
477477

478478
//= specification/searchable-encryption/beacons.md#part-value-calculation
479479
//= 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),
481481
//# 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? ==>
483483
&& ret.value == part.prefix + data
484484
&& 0 < |ret.value|
485485
//= specification/searchable-encryption/beacons.md#value-for-a-compound-beacon
@@ -489,10 +489,10 @@ module CompoundBeacon {
489489

490490
//= specification/searchable-encryption/beacons.md#part-value-calculation
491491
//= type=implication
492-
//# If the part is a [sensitive part](#sensitive-part-initialization),
492+
//# If the part is a [encrypted part](#encrypted-part-initialization),
493493
//# the part value MUST be the concatenation of the part's prefix
494494
//# and the [string hash](#string-hash) of the input string.
495-
ensures part.Sensitive? && ret.Success? ==>
495+
ensures part.Encrypted? && ret.Success? ==>
496496
&& 0 < |ret.value|
497497
&& keys.Keys?
498498
&& part.beacon.hashStr(data, keys.value).Success?
@@ -504,11 +504,11 @@ module CompoundBeacon {
504504
{
505505
:- Need(split !in data, E("Value '" + data + "' for beacon part " + part.getName() + " contains the split character '" + [split] + "'."));
506506
match part {
507-
case Sensitive(p, b) =>
507+
case Encrypted(p, b) =>
508508
:- Need(keys.Keys?, E("Need KeyId for beacon " + b.base.name + " but no KeyId found in query."));
509509
var hash :- b.hashStr(data, keys.value);
510510
Success(part.prefix + hash)
511-
case NonSensitive =>
511+
case Signed =>
512512
Success(part.prefix + data)
513513
}
514514
}

0 commit comments

Comments
 (0)