Skip to main content

Module ntor_v3

Module ntor_v3 

Source
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Β§

DigestWriter πŸ”’
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.
NtorV3Client πŸ”’
Client side of the ntor v3 handshake.
NtorV3HandshakeState πŸ”’
Client state for the ntor v3 handshake.
NtorV3KeyGenerator πŸ”’
A key generator returned from an ntor v3 handshake.
NtorV3PublicKey πŸ”’
Key information about a relay used for the ntor v3 handshake.
NtorV3SecretKey πŸ”’
Secret key information used by a relay for the ntor v3 handshake.
NtorV3Server πŸ”’
Server side of the ntor v3 handshake.
NtorV3XofReader πŸ”’
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 arguments my_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.

Type AliasesΒ§

DigestVal πŸ”’
The output of the digest, as an array.
EncKey πŸ”’
A key for symmetric encryption or decryption.
MacKey πŸ”’
A key for message authentication codes.
MacVal πŸ”’
The output of the MAC.