Documentation ¶
Overview ¶
Package keypool implements a key generation and lookup service for blind signature keys
Index ¶
- Variables
- type FetchKeyCallBackFunc
- type KeyPool
- func (kp *KeyPool) AddVerifyKey(key *[ed25519.PublicKeySize]byte)
- func (kp *KeyPool) Current() (*signkeys.KeyPair, *signkeys.KeyPair, error)
- func (kp *KeyPool) HasVerifyKey(key *[ed25519.PublicKeySize]byte, nolock bool) bool
- func (kp KeyPool) ListVerifyKeys() [][ed25519.PublicKeySize]byte
- func (kp *KeyPool) Load() error
- func (kp *KeyPool) LoadKey(loadKey *signkeys.PublicKey) (*[signkeys.KeyIDSize]byte, error)
- func (kp *KeyPool) LoadKeyUnsafe(loadKey *signkeys.PublicKey) (*[signkeys.KeyIDSize]byte, error)
- func (kp *KeyPool) Lookup(keyid [signkeys.KeyIDSize]byte) (*signkeys.PublicKey, error)
- func (kp *KeyPool) RegisterStorage(fetchFunc FetchKeyCallBackFunc, writeFunc WriteKeyCallbackFunc, ...)
- func (kp KeyPool) SaveKey(keyid [signkeys.KeyIDSize]byte) error
- func (kp KeyPool) SaveKeyUnsafe(keyid [signkeys.KeyIDSize]byte) error
- func (kp KeyPool) WriteKey(key *signkeys.PublicKey) error
- type LoadKeysCallbackFunc
- type WriteKeyCallbackFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned if the keyid could not be found in the keypool ErrNotFound = errors.New("keypool: not found") // ErrNoGenerator is returned if Current() is called on a keypool that has no private signature key ErrNoGenerator = errors.New("keypool: not a generator") // ErrBadUsage is returned if a key to load does not match the usage configuration ErrBadUsage = errors.New("keypool: bad usage setting of key") // ErrExpired is returned if a key has already expired ErrExpired = errors.New("keypool: expired key") // ErrBadSigner is returned if a key signature cannot be verified ErrBadSigner = errors.New("keypool: bad signature") // ErrExists is returned if a key to load is already loaded ErrExists = errors.New("keypool: key exists") )
Functions ¶
This section is empty.
Types ¶
type FetchKeyCallBackFunc ¶
FetchKeyCallBackFunc callback function to read keys from storage. Argument is the keyid, return is the marshalled key or error
type KeyPool ¶
type KeyPool struct { Generator *signkeys.KeyGenerator KeyDir string // Where to save keys VerifyPubKeys map[[ed25519.PublicKeySize]byte]bool // keys to verify against // FetchKeyCallBack callback function to read keys from storage. // Argument is the keyid, return is the marshalled key or error FetchKeyCallBack FetchKeyCallBackFunc // WriteKeyCallback callback function to write keys to storage. // Arguments are the keyid and the marshalled key WriteKeyCallback WriteKeyCallbackFunc // LoadKeysCallback callback function to load many keys from storage // Argument is the keypool to add the keys to LoadKeysCallback LoadKeysCallbackFunc // contains filtered or unexported fields }
KeyPool implements a key pool configuration.
func New ¶
func New(generator *signkeys.KeyGenerator) *KeyPool
New returns a new KeyPool. The generator may require additional settings (Usage, Expire). Those should be set before calling New.
func (*KeyPool) AddVerifyKey ¶
func (kp *KeyPool) AddVerifyKey(key *[ed25519.PublicKeySize]byte)
AddVerifyKey adds key to the list of verification keys.
func (*KeyPool) HasVerifyKey ¶
HasVerifyKey verifies that a verification key exists.
func (KeyPool) ListVerifyKeys ¶
func (kp KeyPool) ListVerifyKeys() [][ed25519.PublicKeySize]byte
ListVerifyKeys lists all known verification keys.
func (*KeyPool) LoadKeyUnsafe ¶
LoadKeyUnsafe adds a single key to the keypool. Without Mutex. be careful. only for use in callback.
func (*KeyPool) RegisterStorage ¶
func (kp *KeyPool) RegisterStorage(fetchFunc FetchKeyCallBackFunc, writeFunc WriteKeyCallbackFunc, loadFunc LoadKeysCallbackFunc)
RegisterStorage registers a storage backend.
func (KeyPool) SaveKeyUnsafe ¶
SaveKeyUnsafe writes keyid to the keydir. Unsafe. No mutex. Only within callbacks.
type LoadKeysCallbackFunc ¶
LoadKeysCallbackFunc callback function to load many keys from storage Argument is the keypool to add the keys to
Directories ¶
Path | Synopsis |
---|---|
Package keydb implements a DB-based keypool storage backend.
|
Package keydb implements a DB-based keypool storage backend. |
Package keydir implements a file-based keypool storage backend.
|
Package keydir implements a file-based keypool storage backend. |
Package storagetests implements tests for the different keypool storage backends.
|
Package storagetests implements tests for the different keypool storage backends. |