ntor

package
v0.0.0-...-15325b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ntor implements the ntor handshake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(h Handshake) []byte

func AuthInput

func AuthInput(h Handshake) []byte

func KDF

func KDF(h Handshake) io.Reader

KDF returns the key derivation function according to HKDF in RFC5869.

func KeySeed

func KeySeed(h Handshake) []byte

func Verify

func Verify(h Handshake) []byte

Types

type ClientHandshake

type ClientHandshake struct {
	Public
	Kx [32]byte
}

func (ClientHandshake) SecretInput

func (c ClientHandshake) SecretInput() []byte

type Handshake

type Handshake interface {
	Shared() Public
	SecretInput() []byte
}

Handshake is a common interface for either side of the handshake.

type Public

type Public struct {
	KX [32]byte
	KY [32]byte
	KB [32]byte
	ID []byte
}

Public contains values both sides have in the handshake.

func (Public) Shared

func (p Public) Shared() Public

type ServerHandshake

type ServerHandshake struct {
	Public
	Ky [32]byte
	Kb [32]byte
}

ServerHandshake assists with computing values in the server-side of circuit creation.

Reference: https://github.com/torproject/torspec/blob/8aaa36d1a062b20ca263b6ac613b77a3ba1eb113/tor-spec.txt#L1100-L1106

The server generates a keypair of y,Y = KEYGEN(), and uses its ntor
private key 'b' to compute:

  secret_input = EXP(X,y) | EXP(X,b) | ID | B | X | Y | PROTOID
  KEY_SEED = H(secret_input, t_key)
  verify = H(secret_input, t_verify)
  auth_input = verify | ID | B | Y | X | PROTOID | "Server"

func (ServerHandshake) SecretInput

func (s ServerHandshake) SecretInput() []byte

Notes

Bugs

  • SecretInput may be computed multiple times

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL