Expand description
Implements the ntor v3 key exchange, as described in proposal 332.
The main difference between the ntor v3r handshake and the original ntor handshake is that this this one allows each party to encrypt data (without forward secrecy) after it sends the first message.
MacrosΒ§
- define_
tweaks π - Helper to define a set of tweak values as instances of
Encap.
StructsΒ§
- Digest
Writer π - Wrapper around a Digest or ExtendedOutput object that lets us use it as a tor_bytes::Writer.
- Encap π
- An encapsulated value for passing as input to a MAC, digest, or KDF algorithm.
- Ntor
V3Client π - Client side of the ntor v3 handshake.
- Ntor
V3Handshake πState - Client state for the ntor v3 handshake.
- Ntor
V3Key πGenerator - A key generator returned from an ntor v3 handshake.
- Ntor
V3Public πKey - Key information about a relay used for the ntor v3 handshake.
- Ntor
V3Secret πKey - Secret key information used by a relay for the ntor v3 handshake.
- Ntor
V3Server π - Server side of the ntor v3 handshake.
- Ntor
V3Xof πReader - Opaque wrapper type for NtorV3βs hash reader.
ConstantsΒ§
- DIGEST_
LEN π - The size of a digest output in bytes.
- ENC_
KEY_ πLEN - The size of an encryption key in bytes.
- ID_LEN π
- The length of a node identity in bytes.
- MAC_
KEY_ πLEN - The size of a MAC key in bytes.
- MAC_LEN π
- The length of a MAC output in bytes.
- NTOR3_
CIRC_ πVERIFICATION - The verification string to be used for circuit extension.
- PROTOID π
- Protocol ID: concatenated with other things in the protocol to prevent hash confusion.
- PUB_
KEY_ πLEN - The size of a curve25519 public key in bytes.
- T_AUTH π
- Authentication tweak: used to derive the final authentication value for the handshake.
- T_FINAL π
- Final KDF tweak: used to derive keys for encrypting relay message and for the actual tor circuit.
- T_
KEY_ πSEED - Key seeding tweak: used to derive final KDF input from secret_input.
- T_
MSGKDF π - Message KDF tweak: used when deriving keys for encrypting and MACing client message.
- T_
MSGMAC π - Message MAC tweak: used to compute the MAC of an encrypted client message.
- T_
VERIFY π - Verifying tweak: used to derive βverifyβ value from secret_input.
TraitsΒ§
- MsgReply π
- Trait for an object that handle and incoming client message and return a serverβs reply.
FunctionsΒ§
- client_
handshake_ πntor_ v3 - Client-side Ntor version 3 handshake, part one.
- client_
handshake_ πntor_ v3_ no_ keygen - As
client_handshake_ntor_v3, but donβt generate an ephemeral DH key: instead take that key an argumentsmy_sk. - client_
handshake_ πntor_ v3_ part2 - Finalize the handshake on the client side.
- decrypt π
- Perform a symmetric decryption operation and return the encrypted data.
- encrypt π
- Perform a symmetric encryption operation and return the encrypted data.
- h_
key_ πseed - Hash tweaked with T_KEY_SEED
- h_
verify π - Hash tweaked with T_VERIFY
- hash π
- Compute a tweaked hash.
- kdf_
msgkdf π - Helper: compute the encryption key and mac_key for the clientβs encrypted message.
- server_
handshake_ πntor_ v3 - Complete an ntor v3 handshake as a server.
- server_
handshake_ πntor_ v3_ no_ keygen - As
server_handshake_ntor_v3, but take a secret key instead of an RNG.