Documentation
¶
Overview ¶
Package gokystr is a simple implementation of a keystore for private keys.
A new keystore instance is created of a folder on the filesystem. The keystore adds private keyfiles present in the folder on initialization automatically to the internal store, if they are parseable.
The name of the keyfile is it's internal ID.
By default private keys will be recognized via the fileextension ".pem".
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoSuchKey is thrown if a key with the given ID is not in the store ErrNoSuchKey = errors.New("no matching key found") // ErrKeyExistsAlready is thrown if a key already exists in the store ErrKeyExistsAlready = errors.New("key is already in the store") // ErrNoKeyFound is thrown if the dir contains no valid key file ErrNoKeyFound = errors.New("no valid keyfiles found in root") // ErrNotADir is thrown if the passed dir is not a directory path ErrNotADir = errors.New("passed path is not a dir") // ErrWrongExtFormat is thrown if the passed key extension does not match '.<ext>' format ErrWrongExtFormat = errors.New("key extension does not match '.<ext>' format") // ErrWrongDirFormat is thrown if the passed dir is not a valid path to open. // Path names must not contain an element that is “.” or “..” or the empty string, // except for the special case that the root directory is named “.”. // Paths must not start or end with a slash: “/x” and “x/” are invalid. ErrWrongDirFormat = errors.New("directory is not in a valid format") )
Functions ¶
func AcceptEmpty ¶
func AcceptEmpty() option
AcceptEmpty prevents the keystore from throwing when using a empty dir
Types ¶
type Keystore ¶
type Keystore struct {
// contains filtered or unexported fields
}
Keystore holds all private keys
func (*Keystore) Add ¶
func (k *Keystore) Add(kid string, key *rsa.PrivateKey) error
Add appends a private key to the keystore
func (*Keystore) PrivateKey ¶
func (k *Keystore) PrivateKey(kid string) (*rsa.PrivateKey, error)
PrivateKey returns the private key from the keystore
Click to show internal directories.
Click to hide internal directories.