mixaddr

package
v0.0.0-...-30b4a77 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2016 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package mixaddr implements key handling functions for mixes and mix clients.

Index

Constants

View Source
const KeySize = 32

KeySize is the size of a key.

Variables

View Source
var Rand = rand.Reader

Rand is the random source for the package.

Functions

This section is empty.

Types

type Address

type Address struct {
	Pubkey   []byte // The mix public key
	Expire   int64  // Time the key expires
	Address  string // The address where the mix listens
	TokenKey []byte // The token key of that mix
}

Address contains a mix address.

type AddressList

type AddressList []Address

AddressList contains many addresses.

func (AddressList) AddStatement

func (adl AddressList) AddStatement(stmt AddressStatement) AddressList

AddStatement adds an address statement to the list of addresses.

func (AddressList) Append

func (adl AddressList) Append(adr ...Address) AddressList

Append an address to an addresslist.

func (AddressList) Expire

func (adl AddressList) Expire(now int64) AddressList

Expire entries from addressList. Returns new addresslist.

func (AddressList) Marshal

func (adl AddressList) Marshal() []byte

Marshal an addresslist.

func (AddressList) Rand

func (adl AddressList) Rand() *Address

Rand returns a random address from the addresslist.

func (AddressList) Sign

func (adl AddressList) Sign(privateKey *[ed25519.PrivateKeySize]byte) []byte

Sign a mix address list.

func (AddressList) Statement

func (adl AddressList) Statement(privateKey *[ed25519.PrivateKeySize]byte) AddressStatement

Statement for an AddressList.

func (AddressList) Unmarshal

func (adl AddressList) Unmarshal(d []byte) (AddressList, error)

Unmarshal an addresslist.

func (AddressList) Verify

func (adl AddressList) Verify(publicKey *[ed25519.PublicKeySize]byte, signature *[ed25519.SignatureSize]byte) bool

Verify a mix address list.

type AddressStatement

type AddressStatement struct {
	Addresses AddressList
	Signature []byte
	PublicKey []byte
}

AddressStatement contains a statement by a mix concerning its addresses.

func (AddressStatement) Verify

func (stmt AddressStatement) Verify() bool

Verify an AddressStatement.

type KeyEntry

type KeyEntry struct {
	Pubkey, Privkey []byte // The mix public and private keys
	Expire          int64  // Time the key expires
	Address         string // The address where the mix listens
	TokenKey        []byte // The token key of that mix
}

KeyEntry contains a mix address, public and private keys.

type KeyList

type KeyList struct {
	Keys            KeyMap
	PrivateKey      *[ed25519.PrivateKeySize]byte
	PublicKey       *[ed25519.PublicKeySize]byte
	Address         string
	Duration        int64
	NewKeyFrequency int64
	Safedir         string
	// contains filtered or unexported fields
}

KeyList is a mix-side implementation of public and private key management.

func New

func New(PrivateKey *[ed25519.PrivateKeySize]byte, address string, duration, newKeyFrequency int64, safedir string) *KeyList

New returns a new KeyList.

func (*KeyList) AddKey

func (kl *KeyList) AddKey()

AddKey adds a key to the list.

func (*KeyList) Expire

func (kl *KeyList) Expire()

Expire does an expire run on the keylist.

func (*KeyList) GetBoundaryTime

func (kl *KeyList) GetBoundaryTime() (first, last int64)

GetBoundaryTime gets the first and last expire from the list.

func (*KeyList) GetKeyEntry

func (kl *KeyList) GetKeyEntry(pubkey *[KeySize]byte) *KeyEntry

GetKeyEntry returns the key entry or nil.

func (*KeyList) GetPrivateKey

func (kl *KeyList) GetPrivateKey(pubkey *[KeySize]byte) *[KeySize]byte

GetPrivateKey returns the private key for a public key, if known.

func (*KeyList) GetStatement

func (kl *KeyList) GetStatement() *AddressStatement

GetStatement returns the current key statement.

func (*KeyList) Maintain

func (kl *KeyList) Maintain()

Maintain starts two routines that maintain the key list in memory.

func (KeyList) Marshal

func (kl KeyList) Marshal() []byte

Marshal the keylist.

func (*KeyList) Unmarshal

func (kl *KeyList) Unmarshal(d []byte) error

Unmarshal a keylist.

type KeyMap

type KeyMap map[[KeySize]byte]KeyEntry

KeyMap maps a public key to a private key.

Jump to

Keyboard shortcuts

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