Skip to content

Commit 1ef0008

Browse files
authored
Fixed HTTPSig example + removed duplicate in ack section (#231)
1 parent 329e1b6 commit 1ef0008

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

IETF-RFC.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -925,22 +925,22 @@ Here is an example of headers needed to sign a request.
925925

926926
~~~~~
927927
{
928-
"(request-target)": "post /path",
928+
"@request-target": "post /path",
929929
"content-length": 380,
930930
"date": "Mon, 08 Jul 2024 14:16:20 GMT",
931-
"digest": "SHA-256=U7gNVUQiixe5BRbp4Tg0xCZMTcSWXXUZI2\\/xtHM40S0=",
931+
"content-digest": "SHA-256=U7gNVUQiixe5BRbp4Tg0xCZMTcSWXXUZI2\\/xtHM40S0=",
932932
"host": "hostname.of.the.recipient",
933933
"Signature": "keyId=\"https://author.hostname/key\",algorithm=\"rsa-sha256\",headers=\"content-length date digest host\",signature=\"DzN12OCS1rsA[...]o0VmxjQooRo6HHabg==\""
934934
}
935935
~~~~~
936936

937-
* '(request-target)' contains the reached endpoint and the used
938-
method,
937+
* '@request-target' (optional) contains the reached endpoint and
938+
the used method,
939939
* 'content-length' is the total length of the payload of the
940940
request,
941941
* 'date' is the date and time when the request has been
942942
sent,
943-
* 'digest' is a checksum of the payload of the
943+
* 'content-digest' is a checksum of the payload of the
944944
request,
945945
* 'host' is the hostname of the recipient of the request (remote when
946946
signing outgoing request, local on incoming request),
@@ -953,7 +953,7 @@ and details on its generation:
953953
signature
954954
* 'signature' the signature of an array containing the properties
955955
listed in 'headers'. Some properties like content-length, date,
956-
digest, and host are mandatory to protect against authenticity
956+
content-digest, and host are mandatory to protect against authenticity
957957
override.
958958

959959

@@ -967,18 +967,17 @@ outgoing requests:
967967

968968
~~~~~
969969
headers = {
970-
'(request-target)': 'post /path',
971970
'content-length': length_of(payload),
972971
'date': current_gmt_datetime(), # Use a function to get the current GMT date as 'D, d M Y H:i:s T'
973-
'digest': 'SHA-256=' + base64_encode(hash('sha256', utf8_encode(payload))),
972+
'content-digest': 'SHA-256=' + base64_encode(hash('sha256', utf8_encode(payload))),
974973
'host': 'recipient-fqdn',
975974
}
976975

977976
signed = ssl_sign(concatenate_with_newlines(headers), private_key, 'sha256')
978977
signature = {
979978
'keyId': 'sender-fqdn', # The sending server's FQDN; find its public key through OCM API discovery
980979
'algorithm': 'rsa-sha256',
981-
'headers': 'content-length date digest host',
980+
'headers': 'content-length date content-digest host',
982981
'signature': signed,
983982
}
984983

@@ -990,10 +989,8 @@ headers['Signature'] = format_signature(signature)
990989
The first step would be to confirm the validity of each
991990
properties:
992991

993-
* `(request-target)` and `host` are immutable to the type of the
994-
request and the local/current host,
995-
* `content-length` and `digest` can be re-generated and compared from
996-
the payload of the request,
992+
* `content-length` and `content-digest` can be regenerated and compared
993+
from the payload of the request,
997994
* a maximum TTL must be applied to `date` and current
998995
timestamp,
999996
* regarding data contained in the `Signature`
@@ -1002,7 +999,7 @@ header:
1002999
signatory,
10031000
* `headers` is used to generate the clear version of the
10041001
signature and must contain at least `content-length`, `date`,
1005-
`digest` and `host`,
1002+
`content-digest` and `host`,
10061003
* `signature` is the encrypted version of the
10071004
signature.
10081005

@@ -1011,10 +1008,9 @@ the signature and the public key:
10111008

10121009
~~~~~
10131010
clear = {
1014-
'(request-target)': 'post /path',
10151011
'content-length': length_of(payload),
10161012
'date': 'Mon, 08 Jul 2024 14:16:20 GMT', # The date used in the verification process
1017-
'digest': 'SHA-256=' + base64_encode(hash('sha256', utf8_encode(payload))), # Recompute the digest for verification
1013+
'content-digest': 'SHA-256=' + base64_encode(hash('sha256', utf8_encode(payload))), # Recompute the digest for verification
10181014
'host': 'sender-fqdn',
10191015
}
10201016

@@ -1096,8 +1092,7 @@ Anna Manou, Rita Meneses, Zheng Meyer-Zhao, Crystal Michelle Chua,
10961092
Yoann Moulin, Daniel Müller, Frederik Müller, Rasmus Munk,
10971093
Michał Orzechowski, Jacek Pawel Kitowski, Iosif Peterfi,
10981094
Alessandro Petraro, Rene Ranger, Angelo Romasanta, David Rousse,
1099-
Carla Sauvanaud, Klaus Scheibenberger, Christian Schmitz,
1100-
Marcin Sieprawski, Tilo Steiger, C.D. Tiwari, Alejandro Unger and
1101-
Tom Wezepoel.
1095+
Carla Sauvanaud, Klaus Scheibenberger, Marcin Sieprawski,
1096+
Tilo Steiger, C.D. Tiwari, Alejandro Unger and Tom Wezepoel.
11021097

11031098
--- back

0 commit comments

Comments
 (0)