@@ -550,7 +550,6 @@ of hub failures (i.e. _n_ - _k_ hubs can fail).
550550
551551## Message authentication
552552
553-
554553To protect against
555554[ Man-in-the-middle attacks] ( https://en.wikipedia.org/wiki/Man-in-the-middle_attack )
556555all in-band DSKE protocol message must be
@@ -563,41 +562,96 @@ The above figure shows how messages sent from clients to hubs are authenticated
563562
564563Client Carol signs sent messages as follows:
565564
566- * Client Carol wants to authenticate an in-band DSKE protocol message for hub Hank.
567- This in-band DSKE message is an HTTP REST message that may contain query parameters and/or
568- a message body.
565+ 1 . Client Carol wants to authenticate an in-band DSKE protocol message for hub Hank.
566+ This in-band DSKE message is an HTTP REST message that may contain query parameters and/or
567+ a message body.
569568
570- * Client Carol allocates a signing key from the PSRD pool associated with hub Hank.
569+ 2 . Client Carol allocates a signing key from the PSRD pool associated with hub Hank.
571570
572- * Client Carol computes the signature for the message in the form of a
573- [ Hashed Message Authentication Code (HMAC)] ( https://en.wikipedia.org/wiki/HMAC )
574- using the message to be signed and the allocated signing key as inputs.
575- The HMAC signature is computed over the query parameters and the body of the signed message.
571+ 3 . Client Carol computes the signature for the message in the form of a
572+ [ Hashed Message Authentication Code (HMAC)] ( https://en.wikipedia.org/wiki/HMAC )
573+ using the message to be signed and the allocated signing key as inputs.
574+ The HMAC signature is computed over the query parameters and the body of the signed message.
576575
577- * Client Carol attaches the computed singing key to the message using the HTTP
578- header ` DSKE-Signature ` .
579- This produces a signed message.
576+ 4 . Carol computes the signature for the request by computing the SHA256
577+ [ Hashed Message Authentication Code (HMAC)] ( https://en.wikipedia.org/wiki/HMAC )
578+ over the concatenation of
579+ (a) the content of the request
580+ (b) the query parameters of the request and
581+ (c) the signing key allocated in step 1.
580582
581- * The ` DSKE-Signature ` header does not only contain the signature itself (i.e. the HMAC code)
582- but also meta-data about the signature key.
583+ 5 . Carol encodes the meta-data of the signing key (but not the signing key value itself)
584+ plus the computed signature into a string and puts this string in the ` DSKE-Signature ` header.
585+ The encoding format is detailed below.
583586
584587Hub Hank validates the signature on received messages as follows:
585588
586- * Hub Hank extracts the following two piece of information from the ` DSKE-Signature ` header
587- on the received message: (a) the meta-data for the signing key and (b) the HMAC signature.
589+ 1 . Hub Hank extracts the following two piece of information from the ` DSKE-Signature ` header
590+ on the received message: (a) the meta-data for the signing key and (b) the HMAC signature.
588591
589- * Hub Hank retrieves the signing key from the PSRD pool associated with client Carol using
590- the signing key meta-data extracted from the ` DSKE-Signature ` header.
592+ 2 . Hub Hank retrieves the signing key from the remote PSRD pool associated with client Carol using
593+ the signing key meta-data extracted from the ` DSKE-Signature ` header.
591594
592- * Hub Hank performs its own local computation of the signature by computing the HMAC over
593- the message received from Client Carol and the singing key retrieved from its local PSRD pool.
595+ 3 . Hub Hank performs its own local computation of the signature by computing the HMAC over
596+ the message received from Client Carol and the singing key retrieved from its local PSRD pool.
594597
595- * If the locally computed signature matches the received signature, the authentication succeeds.
598+ 4 . If the locally computed signature matches the received signature, the authentication succeeds.
596599
597600Note that we don't authenticate out-of-band DSKE messages because the out-of-band REST messages are
598601only intended to simulated what would be a secure physical mechanism in real for automated testing
599602purposes.
600603
604+ The response to a DSKE request is usually also signed in the same way, using a different signing
605+ key freshly allocated from the local PSRD pool of the receiver.
606+ All success responses and most error responses are signed.
607+ In some errors (e.g. the node is out of PSRD data) the response cannot be signed and the error
608+ response is sent without a signature.
609+
610+ The ` DSKE-Signature ` header is encoded as follows:
611+
612+ * The meta-data of the singing key, followed by a semi-colon (;), followed by the signature
613+ encoded using base64 encoding.
614+
615+ * The meta-data of the signing key is encoded as one or more encoded fragment meta-data strings,
616+ separated by commas.
617+
618+ * Each fragment meta-data string is encoded as the block UUID, the start byte within the block,
619+ and the size of the fragment, separated by colons.
620+
621+ * Note that the key data (fragment data) is not encoded into the meta-data.
622+
623+ Example of an encoded signature:
624+
625+ ```
626+ 9ad7f620-5a0c-4979-8a2d-66142e06fd79:0:20,cda527e9-5ca7-40d6-a842-0b606597611c:0:12;V12fwNZiooqE1x0beAdQ4fo2YXnOCTPbUgqG38eUQc4=
627+ ```
628+
629+ The part after the semi-colon is the base64-encoded signature:
630+
631+ ```
632+ V12fwNZiooqE1x0beAdQ4fo2YXnOCTPbUgqG38eUQc4=
633+ ```
634+
635+ The part before the semi-colon is the sequence of two fragments:
636+
637+ ```
638+ 9ad7f620-5a0c-4979-8a2d-66142e06fd79:0:20,cda527e9-5ca7-40d6-a842-0b606597611c:0:12
639+ ```
640+
641+ The first fragment is bytes 0 through 19 of block 9ad7f620-5a0c-4979-8a2d-66142e06fd79:
642+
643+ ```
644+ 9ad7f620-5a0c-4979-8a2d-66142e06fd79:0:20
645+ ```
646+
647+ And the second fragment is bytes 0 through 11 of block cda527e9-5ca7-40d6-a842-0b606597611c:
648+
649+ ```
650+ cda527e9-5ca7-40d6-a842-0b606597611c:0:12
651+ ```
652+
653+
654+
601655## Pool ownership
602656
603657So far, we have seen several scenarios where a node (i.e. a client or a hub) allocates a key from
@@ -883,98 +937,11 @@ Headers:
883937| ---| ---| ---|
884938| ``` DSKE-Signature ``` | string | The authentication signature of the request. |
885939
886- This is explained in the next section.
940+ See section
941+ [ message authentication] ( #message-authentication ) .
887942
888943Successful response body: None
889944
890- ### Authentication using signatures
891-
892- TODO: This is duplicate; merge with the section higher up.
893-
894- All in-band DSKE protocol messages are authenticated using the HTTP ` DSKE-Signature ` header.
895- It contains two pieces of information:
896-
897- 1 . The meta-data for the signing key.
898-
899- 2 . The signature as a base64 encoded sequence of bytes.
900-
901- The sender of an in-band DSKE request signs the request as follows:
902-
903- 1 . The sender allocates a signing key from the local PSRD pool associated with the receiver of
904- the request.
905-
906- 2 . The sender computes the signature by computing the SHA256 HMAC over the concatenation of
907- (a) the content of the request
908- (b) the query parameters of the request and
909- (c) the signing key allocated in step 1.
910-
911- 4 . The sender encodes the meta-data of the signing key (but not the signing key value itself)
912- plus the signature into a string and puts this string in the ` DSKE-Signature ` header.
913- The encoding format is detailed below.
914-
915- The receiver of an in-band DSKE request signs the response as follows:
916-
917- 1 . The receiver decodes the ` DSKE-Signature ` header and extracts the signing key meta-data and
918- the signature.
919-
920- 2 . The receiver uses the signing key meta-data to allocate the same signing key from the remote
921- PSRD pool associated with the sender.
922-
923- 3 . The receiver computes the signature in the same manner as the sender (see step 2 for the
924- sender).
925-
926- 4 . The received compares the locally computed signature with the received signature.
927- If they match, the authentication succeeds.
928-
929- The response to a DSKE request is usually also signed in the same way, using a different signing
930- key freshly allocated from the local PSRD pool of the receiver.
931- All success responses and most error responses are signed.
932- In some errors (e.g. the node is out of PSRD data) the response cannot be signed and the error
933- response is sent without a signature.
934-
935- The ` DSKE-Signature ` header is encoded as follows:
936-
937- * The meta-data of the singing key, followed by a semi-colon (;), followed by the signature
938- encoded using base64 encoding.
939-
940- * The meta-data of the signing key is encoded as one or more encoded fragment meta-data strings,
941- separated by commas.
942-
943- * Each fragment meta-data string is encoded as the block UUID, the start byte within the block,
944- and the size of the fragment, separated by colons.
945-
946- * Note that the key data (fragment data) is not encoded into the meta-data.
947-
948- Example of an encoded signature:
949-
950- ```
951- 9ad7f620-5a0c-4979-8a2d-66142e06fd79:0:20,cda527e9-5ca7-40d6-a842-0b606597611c:0:12;V12fwNZiooqE1x0beAdQ4fo2YXnOCTPbUgqG38eUQc4=
952- ```
953-
954- The part after the semi-colon is the base64-encoded signature:
955-
956- ```
957- V12fwNZiooqE1x0beAdQ4fo2YXnOCTPbUgqG38eUQc4=
958- ```
959-
960- The part before the semi-colon is the sequence of two fragments:
961-
962- ```
963- 9ad7f620-5a0c-4979-8a2d-66142e06fd79:0:20,cda527e9-5ca7-40d6-a842-0b606597611c:0:12
964- ```
965-
966- The first fragment is bytes 0 through 19 of block 9ad7f620-5a0c-4979-8a2d-66142e06fd79:
967-
968- ```
969- 9ad7f620-5a0c-4979-8a2d-66142e06fd79:0:20
970- ```
971-
972- And the second fragment is bytes 0 through 11 of block cda527e9-5ca7-40d6-a842-0b606597611c:
973-
974- ```
975- cda527e9-5ca7-40d6-a842-0b606597611c:0:12
976- ```
977-
978945### Initiator encryptor sends key ID to responder encryptor
979946
980947Once the initiator encryptor (Sam) has received the key ID and the key value from the initiator
@@ -1097,9 +1064,8 @@ Headers:
10971064| ---| ---| ---|
10981065| ``` DSKE-Signature ``` | string | The authentication signature of the request. |
10991066
1100- See the
1101- [ authentication using signatures] ( #authentication-using-signatures )
1102- section for details.
1067+ See section
1068+ [ message authentication] ( #message-authentication ) .
11031069
11041070Request body: None.
11051071
0 commit comments