@@ -247,8 +247,7 @@ file type. The key is sent using the [JSON Web
247
247
Key] ( https://tools.ietf.org/html/rfc7517#appendix-A.3 ) format, with a
248
248
[ W3C extension] ( https://w3c.github.io/webcrypto/#iana-section-jwk ) .
249
249
250
- Extensions to ` m.room.message ` msgtypes
251
- < ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;< ;
250
+ ###### Extensions to ` m.room.message ` msgtypes
252
251
253
252
This module adds ` file ` and ` thumbnail_file ` properties, of type
254
253
` EncryptedFile ` , to ` m.room.message ` msgtypes that reference files, such
@@ -572,8 +571,7 @@ To advertise support for this method, clients use the name `m.sas.v1` in the
572
571
` methods ` fields of the ` m.key.verification.request ` and
573
572
` m.key.verification.ready ` events.
574
573
575
- The verification process takes place over [ to-device] ( #send-to-device-messaging ) messages in two
576
- phases:
574
+ The verification process takes place in two phases:
577
575
578
576
1 . Key agreement phase (based on [ ZRTP key
579
577
agreement] ( https://tools.ietf.org/html/rfc6189#section-4.4.1 ) ).
@@ -584,63 +582,62 @@ The process between Alice and Bob verifying each other would be:
584
582
1 . Alice and Bob establish a secure out-of-band connection, such as
585
583
meeting in-person or a video call. "Secure" here means that either
586
584
party cannot be impersonated, not explicit secrecy.
587
- 2 . Alice and Bob communicate which devices they'd like to verify with
588
- each other.
589
- 3 . Alice selects Bob's device from the device list and begins
590
- verification.
591
- 4 . Alice's client ensures it has a copy of Bob's device key.
592
- 5 . Alice's device sends Bob's device an ` m.key.verification.start `
593
- message.
594
- 6 . Bob's device receives the message and selects a key agreement
585
+ 2 . Alice and Bob begin a key verification using the key verification
586
+ framework as described above.
587
+ 3 . Alice's device sends Bob's device an ` m.key.verification.start `
588
+ message. Alice's device ensures it has a copy of Bob's device key.
589
+ 4 . Bob's device receives the message and selects a key agreement
595
590
protocol, hash algorithm, message authentication code, and SAS
596
591
method supported by Alice's device.
597
- 7 . Bob's device ensures it has a copy of Alice's device key.
598
- 8 . Bob's device creates an ephemeral Curve25519 key pair
592
+ 5 . Bob's device ensures it has a copy of Alice's device key.
593
+ 6 . Bob's device creates an ephemeral Curve25519 key pair
599
594
(* K<sub >B</sub ><sup >private</sup >* , * K<sub >B</sub ><sup >public</sup >* ),
600
595
and calculates the hash (using the chosen algorithm) of the public
601
596
key * K<sub >B</sub ><sup >public</sup >* .
602
- 9 . Bob's device replies to Alice's device with an
597
+ 7 . Bob's device replies to Alice's device with an
603
598
` m.key.verification.accept ` message.
604
- 10 . Alice's device receives Bob's message and stores the commitment hash
599
+ 8 . Alice's device receives Bob's message and stores the commitment hash
605
600
for later use.
606
- 11 . Alice's device creates an ephemeral Curve25519 key pair
601
+ 9 . Alice's device creates an ephemeral Curve25519 key pair
607
602
(* K<sub >A</sub ><sup >private</sup >* , * K<sub >A</sub ><sup >public</sup >* )
608
603
and replies to Bob's device with an ` m.key.verification.key ` ,
609
604
sending only the public key
610
605
* K<sub >A</sub ><sup >public</sup >* .
611
- 12 . Bob's device receives Alice's message and replies with its own
606
+ 10 . Bob's device receives Alice's message and replies with its own
612
607
` m.key.verification.key ` message containing its public key
613
608
* K<sub >B</sub ><sup >public</sup >* .
614
- 13 . Alice's device receives Bob's message and verifies the commitment
609
+ 11 . Alice's device receives Bob's message and verifies the commitment
615
610
hash from earlier matches the hash of the key Bob's device just sent
616
611
and the content of Alice's ` m.key.verification.start ` message.
617
- 14 . Both Alice and Bob's devices perform an Elliptic-curve
612
+ 12 . Both Alice and Bob's devices perform an Elliptic-curve
618
613
Diffie-Hellman
619
614
(* ECDH(K<sub >A</sub ><sup >private</sup >* , * K<sub >B</sub ><sup >public</sup >* )),
620
615
using the result as the shared secret.
621
- 15 . Both Alice and Bob's devices display a SAS to their users, which is
616
+ 13 . Both Alice and Bob's devices display a SAS to their users, which is
622
617
derived from the shared key using one of the methods in this
623
618
section. If multiple SAS methods are available, clients should allow
624
619
the users to select a method.
625
- 16 . Alice and Bob compare the strings shown by their devices, and tell
620
+ 14 . Alice and Bob compare the strings shown by their devices, and tell
626
621
their devices if they match or not.
627
- 17 . Assuming they match, Alice and Bob's devices calculate the HMAC of
622
+ 15 . Assuming they match, Alice and Bob's devices calculate the HMAC of
628
623
their own device keys and a comma-separated sorted list of the key
629
624
IDs that they wish the other user to verify, using SHA-256 as the
630
625
hash function. HMAC is defined in [ RFC
631
626
2104] ( https://tools.ietf.org/html/rfc2104 ) . The key for the HMAC is
632
627
different for each item and is calculated by generating 32 bytes
633
628
(256 bits) using [ the key verification HKDF] ( #hkdf-calculation ) .
634
- 18 . Alice's device sends Bob's device an ` m.key.verification.mac `
629
+ 16 . Alice's device sends Bob's device an ` m.key.verification.mac `
635
630
message containing the MAC of Alice's device keys and the MAC of her
636
631
key IDs to be verified. Bob's device does the same for Bob's device
637
632
keys and key IDs concurrently with Alice.
638
- 19 . When the other device receives the ` m.key.verification.mac ` message,
633
+ 17 . When the other device receives the ` m.key.verification.mac ` message,
639
634
the device calculates the HMAC of its copies of the other device's
640
635
keys given in the message, as well as the HMAC of the
641
636
comma-separated, sorted, list of key IDs in the message. The device
642
637
compares these with the HMAC values given in the message, and if
643
638
everything matches then the device keys are verified.
639
+ 18 . Alice and Bob's devices send ` m.key.verification.done ` messages to complete
640
+ the verification.
644
641
645
642
The wire protocol looks like the following between Alice and Bob's
646
643
devices:
0 commit comments