Skip to content

Commit a45dd32

Browse files
committed
Docs update
1 parent 189a35f commit a45dd32

7 files changed

Lines changed: 64 additions & 42 deletions

File tree

client/peer_hub.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ async def attempt_request_psrd(self, pool: Pool) -> bool:
195195
url = f"{self._base_url}/dske/oob/v1/psrd"
196196
match pool.owner:
197197
case Pool.Owner.LOCAL:
198-
pool_owner_str = "client"
198+
owner_str = "client"
199199
case Pool.Owner.PEER:
200-
pool_owner_str = "hub"
200+
owner_str = "hub"
201201
params = {
202202
"client_name": self._client.name,
203-
"pool_owner": pool_owner_str,
203+
"owner": owner_str,
204204
"size": GET_PSRD_BLOCK_SIZE,
205205
}
206206
try:

common/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ def __init__(self, client_name: str):
3333
)
3434

3535

36-
class InvalidPoolOwnerError(DSKEException):
36+
class InvalidOwnerError(DSKEException):
3737
"""
3838
Exception raised when an invalid pool owner is specified.
3939
"""
4040

41-
def __init__(self, pool_owner_str: str):
41+
def __init__(self, owner_str: str):
4242
super().__init__(
4343
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
44-
message=f"Pool owner {pool_owner_str} is invalid.",
44+
message=f"Owner {owner_str} is invalid.",
4545
)
4646

4747

docs/getting-started-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ INFO: Begin request PSRD task for peer hub hugo and pool owner local
301301
INFO: Begin request PSRD task for peer hub hugo and pool owner peer
302302
INFO: Begin request PSRD task for peer hub helen and pool owner local
303303
INFO: Begin request PSRD task for peer hub helen and pool owner peer
304-
INFO: Call GET http://127.0.0.1:8100/hub/hank/dske/oob/v1/psrd?client_name=carol&pool_owner=client&size=2000 200
304+
INFO: Call GET http://127.0.0.1:8100/hub/hank/dske/oob/v1/psrd?client_name=carol&owner=client&size=2000 200
305305
INFO: Finish request PSRD task for peer hub hank and pool owner local
306-
INFO: Call GET http://127.0.0.1:8100/hub/hank/dske/oob/v1/psrd?client_name=carol&pool_owner=hub&size=2000 200
306+
INFO: Call GET http://127.0.0.1:8100/hub/hank/dske/oob/v1/psrd?client_name=carol&owner=hub&size=2000 200
307307
...
308308
INFO: Call POST http://127.0.0.1:8104/hub/hugo/dske/api/v1/key-share 200
309309
INFO: Successfully scattered 5 out of 5 shares for key ID 0aa99444-fddc-44d2-ac23-49657e5e6021

docs/protocol-guide.md

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -186,29 +186,37 @@ for example ETSI does not have the concept of splitting a key into shares or Pre
186186

187187
We start with a high-level overview of how the protocol works.
188188
Our goal is try to avoid losing the forest for the trees later on when we dive into the details.
189-
We gloss over many important details and we use some terminology without defining it; these
190-
details and definitions will be filled in in the remainder of the chapter.
189+
We gloss over many important details which will be explained later.
191190

192191
We have a network consisting of network nodes.
193192
These nodes are connected to each other using a normal IP network (i.e. using routers and switches).
194193

195194
Some of these nodes want to exchange encrypted traffic with each other, and for this reason they
196195
need to agree on encryption keys.
197-
We refer to these nodes as DSKE client nodes, or simply clients.
198-
The clients are running the DSKE protocol as the key establishment protocol.
196+
We refer to these nodes as encryptors.
197+
198+
Each encryptor is connected to a DSKE client, or client for short.
199+
The clients are responsible for producing the symmetric encryption keys and
200+
for delivering those encryption keys to the encryptors.
201+
202+
The clients run the DSKE protocol as the key establishment protocol.
199203

200204
The DSKE protocol relies heavily on using very large blocks of Pre-Shared Random Data (PSRD).
201-
Before two nodes can establish keys, they first need to exchange blocks of PSRD.
205+
206+
Before a pair of clients can establish keys, they first need to exchange blocks of PSRD.
207+
202208
The exchange of PSRD uses what we refer to as a secure out-of-band mechanism.
203209
Think, for example, of using armed guards to exchange tamper-proof disks full of random data,
204210
where the disks are destroyed after the same block of PSRD is delivered to each of a pair of nodes.
205211

212+
Later, we will see that clients don't exchange PSRD directly with each other, but through
213+
a set of intermediate nodes called DSKE Security Hubs, or just hubs for short.
214+
206215
Imagine, for now, that two clients Carol and Celia have exchanged blocks of PSRD.
207216
This means that Carol and Celia both have a identical copies of the PSRD blocks, and no-one else
208217
knows what these blocks of PSRD are.
209218

210-
Carol and Celia can now agree on a Carol-Celia encryption key using a public
211-
conversation.
219+
Carol and Celia can now agree on a Carol-Celia encryption key using a public conversation.
212220
For example, Carol could announce that she will use bytes numbers 100 through 228 of PSRD block
213221
number 123 as the key.
214222
We refer to this as the meta-data for the encryption key.
@@ -227,6 +235,9 @@ the message itself to the receiver (say Celia).
227235
Celia uses the received key meta-data to extract the authentication key value from her copy of the
228236
PSRD and uses it to validate the received signature.
229237

238+
Once Carol and Celia have established an encryption key, they deliver that encryption key to
239+
the encryptors using a key delivery protocol such as ETSI QKD 014 or SKIP.
240+
230241
The scheme that we have described thus far becomes impractical if we have a very large number of
231242
clients.
232243
Each client would have to pro-actively and a-priori exchange PSRD with each of the other clients
@@ -235,8 +246,8 @@ on the network that it could potentially wish to communicate with at some point
235246
For this reason, we introduce a second type of node that we refer to as a DSKE security hub,
236247
or simply hub for short.
237248

238-
Instead of establishing a key directly between a pair of clients, we use the hubs as trusted relay
239-
nodes.
249+
Instead of establishing a key directly between a pair of clients, we use the hubs as a sort of
250+
Trusted Relay Nodes (TRNs).
240251
The clients do not establish PSRD with directly with each other;
241252
instead, the clients establish PSRD with the hubs.
242253

@@ -646,16 +657,31 @@ As a result, the client registration is idem-potent and it is not an error for a
646657
itself multiple times. This can happen, for example, when a client crashes and restarts.
647658

648659
In the request, the client provides its own `client_name`.
660+
The client also provides a list of `encryptor_names` that are attached to the client.
661+
This is used by the hub to verify whether the client only produces or consumes keys for directly
662+
attached encryptors.
663+
649664
In the response, the hub provides its `hub_name`.
650665

651666
Method: `PUT`
652667

653668
URL: `/hub/{hub_name}/dske/oob/v1/registration`
654669

670+
Note that we include the node name (in this case `hub_name`) in the path of the URL;
671+
this allows deployments where all nodes run on a single server on a single port
672+
behind a reverse proxy (e.g.
673+
[NGINX](https://nginx.org/)
674+
)
675+
where the reverse proxy uses the node name in the URL to dispatch the request to the correct
676+
process.
677+
655678
Request body:
656679
```
657680
{
658681
"client_name": "string" # The name of the client.
682+
"encryptor_names": [ # List of encryptors attached to the client
683+
"string", ... # Name of one encryptor attached to the client
684+
]
659685
}
660686
```
661687

@@ -666,14 +692,6 @@ Successful response body:
666692
}
667693
```
668694

669-
Note that we include the node name (in this case `hub_name`) in the path of the URL;
670-
this allows deployments where all nodes run on a single server on a single port
671-
behind a reverse proxy (e.g.
672-
[NGINX](https://nginx.org/)
673-
)
674-
where the reverse proxy uses the node name in the URL to dispatch the request to the correct
675-
process.
676-
677695
### Request Pre-Shared Random Data (PSRD)
678696

679697
Once a client has successfully registered itself with a particular hub, it requests its initial
@@ -819,14 +837,18 @@ TODO: Document `DSKE-Signature` header here
819837
Request body:
820838
```
821839
{
822-
"client_name": "string", # The name of the client.
840+
"master_client_name": "string", # The name of the master client.
841+
"master_sae_id": "string", # The SAE ID (encryptor name) of the master SAE
842+
"slave_sae_id": "string", # The SAE ID (encryptor name) of the slave SAE
823843
"user_key_id": "string", # The UUID of the user key.
824844
"share_index": "integer", # The index of the share (0, 1, ..., n-1).
825845
"encryption_key_allocation": { # The PSRD pool allocation for the share encryption key.
826-
[ # List of allocation fragments
827-
block_uuid: "string", # The UUID of the PSRD block from which the fragment was allocated.
828-
start_byte: "integer", # The index of the start byte for the fragment within the block.
829-
size: "integer" # The size of the fragment
846+
"fragments": [ # List of fragments in the allocation
847+
{ # One fragment in the allocation
848+
block_uuid: "string", # The UUID of the PSRD block from which the fragment was allocated.
849+
start_byte: "integer", # The index of the start byte for the fragment within the block.
850+
size: "integer" # The size of the fragment
851+
}, ...
830852
]
831853
},
832854
"encrypted_share_value": "string" # Base64 encoded encrypted share value

hub/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ async def put_oob_client_registration(
118118
@_APP.get(f"/hub/{_HUB.name}/dske/oob/v1/psrd")
119119
async def get_oob_psrd(
120120
client_name: str,
121-
pool_owner: str,
121+
owner: str,
122122
size: pydantic.PositiveInt,
123123
) -> APIBlock:
124124
"""
125125
DSKE Out of band: Get a block of Pre-Shared Random Data (PSRD).
126126
"""
127-
block = _HUB.generate_block_for_client(client_name, pool_owner, size)
127+
block = _HUB.generate_block_for_client(client_name, owner, size)
128128
return block.to_api()
129129

130130

hub/hub.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def register_client(
7171
return peer_client
7272

7373
def generate_block_for_client(
74-
self, client_name: str, pool_owner_str: str, size: int
74+
self, client_name: str, owner_str: str, size: int
7575
) -> Block:
7676
"""
7777
Generate a block of PSRD for a peer client.
@@ -80,17 +80,17 @@ def generate_block_for_client(
8080
LOGGER.warning(f"Peer client '{client_name}' not found")
8181
raise exceptions.ClientNotRegisteredError(client_name)
8282
peer_client = self._peer_clients[client_name]
83-
match pool_owner_str.lower():
83+
match owner_str.lower():
8484
case "client":
85-
pool_owner = Pool.Owner.PEER
85+
owner = Pool.Owner.PEER
8686
case "hub":
87-
pool_owner = Pool.Owner.LOCAL
87+
owner = Pool.Owner.LOCAL
8888
case _:
8989
LOGGER.warning(
90-
f"Invalid pool owner {pool_owner_str} for peer client {client_name}"
90+
f"Invalid owner {owner_str} for peer client {client_name}"
9191
)
92-
raise exceptions.InvalidPoolOwnerError(pool_owner_str)
93-
block = peer_client.create_random_block(pool_owner, size)
92+
raise exceptions.InvalidOwnerError(owner_str)
93+
block = peer_client.create_random_block(owner, size)
9494
return block
9595

9696
async def store_share_received_from_client(

hub/peer_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ def to_mgmt(self):
6868
"peer_pool": self._peer_pool.to_mgmt(),
6969
}
7070

71-
def create_random_block(self, pool_owner: Pool.Owner, size: int) -> Block:
71+
def create_random_block(self, owner: Pool.Owner, size: int) -> Block:
7272
"""
7373
Create a block filled ith random data and add it to the specified pool.
7474
"""
7575
block = Block.new_with_random_data(size)
76-
match pool_owner:
76+
match owner:
7777
case Pool.Owner.LOCAL:
7878
pool = self._local_pool
7979
case Pool.Owner.PEER:
8080
pool = self._peer_pool
8181
case _:
82-
assert_never("Invalid pool owner")
82+
assert_never("Invalid owner")
8383
pool.add_block(block)
8484
return block
8585

0 commit comments

Comments
 (0)