Documentation ¶
Overview ¶
Package mixaddr implements key handling functions for mixes and mix clients.
Index ¶
- Constants
- Variables
- type Address
- type AddressList
- func (adl AddressList) AddStatement(stmt AddressStatement) AddressList
- func (adl AddressList) Append(adr ...Address) AddressList
- func (adl AddressList) Expire(now int64) AddressList
- func (adl AddressList) Marshal() []byte
- func (adl AddressList) Rand() *Address
- func (adl AddressList) Sign(privateKey *[ed25519.PrivateKeySize]byte) []byte
- func (adl AddressList) Statement(privateKey *[ed25519.PrivateKeySize]byte) AddressStatement
- func (adl AddressList) Unmarshal(d []byte) (AddressList, error)
- func (adl AddressList) Verify(publicKey *[ed25519.PublicKeySize]byte, signature *[ed25519.SignatureSize]byte) bool
- type AddressStatement
- type KeyEntry
- type KeyList
- func (kl *KeyList) AddKey()
- func (kl *KeyList) Expire()
- func (kl *KeyList) GetBoundaryTime() (first, last int64)
- func (kl *KeyList) GetKeyEntry(pubkey *[KeySize]byte) *KeyEntry
- func (kl *KeyList) GetPrivateKey(pubkey *[KeySize]byte) *[KeySize]byte
- func (kl *KeyList) GetStatement() *AddressStatement
- func (kl *KeyList) Maintain()
- func (kl KeyList) Marshal() []byte
- func (kl *KeyList) Unmarshal(d []byte) error
- type KeyMap
Constants ¶
const KeySize = 32
KeySize is the size of a key.
Variables ¶
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) 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) GetBoundaryTime ¶
GetBoundaryTime gets the first and last expire from the list.
func (*KeyList) GetKeyEntry ¶
GetKeyEntry returns the key entry or nil.
func (*KeyList) GetPrivateKey ¶
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.