keymgr

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Headers

func Headers(filename string) (headers []string, err error)

func OpenAppend

func OpenAppend(name string) (f *os.File, err error)

OpenAppend opens a file in Append mode and sets user-only permissions

func OpenCreate

func OpenCreate(name string) (f *os.File, err error)

OpenCreate opens a new file in Write mode and sets user-only permissions

Types

type Pubring

type Pubring struct {
	// contains filtered or unexported fields
}

func NewPubring

func NewPubring(pubfile, statfile string) *Pubring

func (Pubring) Candidates

func (p Pubring) Candidates(minlat, maxlat int, minrel float32, exit bool) (c []string)

Candidates provides a list of remailer addresses that match the specified criteria

func (Pubring) Count

func (p Pubring) Count() int

Count returns the number of known Public keys

func (Pubring) Get

func (p Pubring) Get(ref string) (r Remailer, err error)

Get returns a remailer's public info when requested by name or address

func (*Pubring) HaveStats

func (p *Pubring) HaveStats() bool

func (*Pubring) ImportPubring

func (p *Pubring) ImportPubring() (err error)

ImportPubring reads a YAMN Pubring.mix file

func (*Pubring) ImportStats

func (p *Pubring) ImportStats() (err error)

ImportStats reads an mlist2.txt style file into a Pubring struct

func (Pubring) KeyList

func (p Pubring) KeyList() (addresses []string)

Produces a list of public key headers

func (*Pubring) KeyRefresh

func (p *Pubring) KeyRefresh() bool

KeyRefresh returns True if the Pubring file has been modified

func (Pubring) Put

func (p Pubring) Put(r Remailer)

Put inserts a new remailer struct into the Keyring

func (*Pubring) StatRefresh

func (p *Pubring) StatRefresh() (refresh bool)

StatRefresh returns True if the mlist2.txt file has been modified

func (*Pubring) StatsStale

func (p *Pubring) StatsStale(h int) bool

StatsStale returns true if stats are over h hours old

func (*Pubring) UseExpired

func (p *Pubring) UseExpired()

type Remailer

type Remailer struct {
	Address string // Remailer Address
	Keyid   []byte // 16 Byte Mixmaster KeyID

	PK []byte // Curve25519 Public Key
	// contains filtered or unexported fields
}

type Secring

type Secring struct {
	// contains filtered or unexported fields
}

func NewSecring

func NewSecring(secfile, pubkey string) *Secring

NewSecring is a constructor for the Secret Keyring

func (*Secring) Count

func (s *Secring) Count() int

Count returns the number of secret keys in memory

func (*Secring) Get

func (s *Secring) Get(keyid string) (sec secret, err error)

Return the Secret struct that corresponds to the requested Keyid

func (*Secring) GetSK

func (s *Secring) GetSK(keyid string) (sk []byte, err error)

Return the Secret Key that corresponds to the requested Keyid

func (*Secring) ImportSecring

func (s *Secring) ImportSecring() (err error)

ImportSecring reads a YAML secring.mix file into memory

func (*Secring) Insert

func (s *Secring) Insert(pub, sec []byte) (keyidstr string)

Insert puts a new secret key into memory and returns its keyid

func (*Secring) ListKeyids

func (s *Secring) ListKeyids() (keyids []string)

ListKeyids returns a string slice of all in-memory secret keyids

func (*Secring) Purge

func (s *Secring) Purge() (active, expiring, expired, purged int)

Purge deletes expired keys and writes current ones to a backup secring

func (*Secring) SetAddress

func (s *Secring) SetAddress(addy string)

SetAddress validates and sets the remailer address

func (*Secring) SetExit

func (s *Secring) SetExit(exit bool)

SetExit defines if this is a Middle or Exit remailer

func (*Secring) SetName

func (s *Secring) SetName(name string)

SetName validates and sets the remailer name

func (*Secring) SetValidity

func (s *Secring) SetValidity(valid, grace int)

SetValidity defines the time duration over which a key is deemed valid

func (*Secring) SetVersion

func (s *Secring) SetVersion(v string)

SetVersion sets the version string used on keys

func (*Secring) WriteMyKey

func (s *Secring) WriteMyKey(filename string) (keyidstr string)

WriteMyKey writes the local public key to filename with current configurtaion settings.

func (*Secring) WritePublic

func (s *Secring) WritePublic(pub []byte, keyidstr string)

WritePublic writes the Public Key to disk.

func (*Secring) WriteSecret

func (s *Secring) WriteSecret(keyidstr string)

WriteSecret adds the selected secret key to the secret keyring file

Jump to

Keyboard shortcuts

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