Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Optional Key Generator Generator Generator }
Config is the configuration for a base KeyManager.
type Disk ¶
type Disk struct {
// contains filtered or unexported fields
}
Disk extends the base KeyManager to store keys in disk.
func NewDiskKeyManager ¶
NewDiskKeyManager creates a new Disk that stores keys in disk.
func (*Disk) GenerateKey ¶
func (d *Disk) GenerateKey(ctx context.Context, keyID string, keyType cryptoutil.KeyType) (Key, error)
GenerateKey generates a new key and stores it in disk.
type Generator ¶
type Generator interface { GenerateRSA2048Key() (*rsa.PrivateKey, error) GenerateRSA4096Key() (*rsa.PrivateKey, error) }
Generator is an interface for generating keys.
type Key ¶
Key is an interface for an opaque key that can be used for signing. It also provides a method for getting the ID of the key.
type KeyEntry ¶
type KeyEntry struct { PrivateKey crypto.Signer PublicKey crypto.PublicKey // contains filtered or unexported fields }
KeyEntry is a key entry in the KeyManager. It implements the Key interface.
func (*KeyEntry) Public ¶
Public returns the public key corresponding to the private key of the KeyEntry.
type KeyManager ¶
type KeyManager interface { // GenerateKey generates a new key with the given ID and key type. // If a key with that ID already exists, it is overwritten. GenerateKey(ctx context.Context, id string, keyType cryptoutil.KeyType) (Key, error) // GetKey returns the key with the given ID. If the key id does not exist, // an error is returned. GetKey(ctx context.Context, id string) (Key, error) // GetKeys returns all keys managed by the Memory. GetKeys(ctx context.Context) ([]Key, error) }
KeyManager provides a common interface for managing keys.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is a key manager that keeps keys in memory.
func NewMemoryKeyManager ¶
func (Memory) GenerateKey ¶
func (b Memory) GenerateKey(ctx context.Context, keyID string, keyType cryptoutil.KeyType) (Key, error)
GenerateKey creates a new key pair and stores it in the KeyManager.