1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! `adb pair`: putting a key on a device that has never seen it.
//!
//! A key the device already trusts — one approved at a USB prompt —
//! needs none of this: [`Connection::connect_tls`](crate::Connection::connect_tls)
//! is accepted straight away, because adbd checks both against the same
//! store. Pairing is for a key it has never seen.
//!
//! The exchange runs on a port of its own, which the device shows with
//! a six-digit code once "Pair device with pairing code" is tapped on
//! its "Wireless debugging" screen, and which is not the port a session
//! later uses.
//!
//! # The shape of it
//!
//! 1. TLS 1.3, both sides presenting certificates neither of them
//! checks. The device's is generated fresh for the pairing server.
//! 2. The password is *not* the six-digit code. It is that code's ASCII
//! bytes with 64 bytes of TLS exporter output appended, under the
//! label `adb-label\0`. Binding the password to the session is what
//! stops the exchange being replayed elsewhere.
//! 3. One SPAKE2 message each way, 32 bytes apiece.
//! 4. One encrypted `PeerInfo` each way: the host sends its public key,
//! the device answers with its GUID.
//!
//! A wrong code shows up only at step four, as a message that will not
//! authenticate.
pub use ;
pub use ;
pub use ;
pub use ;