Skip to content

Commit 9b3f01b

Browse files
authored
MSC3783: Fixed base64 for SAS verification (#3783)
* proposal for using fixed base64 encoding * use MSC number * add missing word * add links to spec and clarifications
1 parent b5bf09e commit 9b3f01b

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# MSC3783: Fixed base64 for SAS verification
2+
3+
libolm's original implementation for calculating the
4+
[MAC](https://spec.matrix.org/v1.5/client-server-api/#mkeyverificationmac) for
5+
SAS-based device verification [encoded the base64 output
6+
incorrectly](https://gitlab.matrix.org/matrix-org/olm/-/merge_requests/16).
7+
Thus other implementations that use a correct base64 encoding are not
8+
compatible, and must instead [re-implement libolm's incorrect
9+
encoding](https://matrix-org.github.io/vodozemac/vodozemac/sas/struct.EstablishedSas.html#method.calculate_mac_invalid_base64).
10+
libolm now has a function that returns the correct base64 encoding, but it is
11+
currently not used to ensure compatibility with older clients.
12+
13+
This proposal introduces a new message authentication code identifier for use
14+
with SAS verification that uses the correct base64 encoding. The current
15+
method will be deprecated.
16+
17+
## Proposal
18+
19+
A new message authentication code identifier `hkdf-hmac-sha256.v2` is
20+
introduced. This identifier is used in the `message_authentication_codes`
21+
property of the
22+
[`m.key.verification.start`](https://spec.matrix.org/v1.5/client-server-api/#mkeyverificationstartmsasv1)
23+
event, and the `message_authentication_code` property of the
24+
[`m.key.verification.accept`](https://spec.matrix.org/v1.5/client-server-api/#mkeyverificationaccept)
25+
event. Clients that implement SAS verification are required to implement this
26+
method. The `message_authentication_codes` parameter for the
27+
[`m.key.verification.start`](https://spec.matrix.org/v1.5/client-server-api/#mkeyverificationstartmsasv1)
28+
event will require clients to include `hkdf-hmac-sha256.v2`. Clients are no
29+
longer required to include `hkdf-hmac-sha256`, but should still do so for
30+
compatibility with older clients.
31+
32+
When the two clients that are verifying each other agree to use
33+
this method, the MAC is calculated in the same way as `hkdf-hmac-sha256`, but
34+
is encoded to base64 correctly.
35+
36+
The old `hkdf-hmac-sha256` method is redefined to use the base64 encoding
37+
implemented in the original libolm implementation, and is deprecated: if both
38+
clients involved in the verification support `hkdf-hmac-sha256.v2` as the
39+
message authentication code, then `hkdf-hmac-sha256` must not be used, even if
40+
both clients support it.
41+
42+
`hkdf-hmac-sha256` will be removed by a future MSC.
43+
44+
## Potential issues
45+
46+
None
47+
48+
## Alternatives
49+
50+
None
51+
52+
## Security considerations
53+
54+
This change does not introduce any security issues.
55+
56+
## Unstable prefix
57+
58+
Until this MSC is accepted, the key agreement protocol identifier
59+
`org.matrix.msc3783.hkdf-hmac-sha256` should be used instead of
60+
`hkdf-hmac-sha256.v2`.
61+
62+
## Dependencies
63+
64+
None

0 commit comments

Comments
 (0)