package keydbstore

import "github.com/theupdateframework/notary/signer/keydbstore"

Index

Constants

const (
	EncryptionAlg = jose.A256GCM
	KeywrapAlg    = jose.PBES2_HS256_A128KW
)

Constants

Types

type GormPrivateKey

type GormPrivateKey struct {
	gorm.Model
	KeyID           string `sql:"not null;unique;index:key_id_idx"`
	EncryptionAlg   string `sql:"not null"`
	KeywrapAlg      string `sql:"not null"`
	Algorithm       string `sql:"not null"`
	PassphraseAlias string `sql:"not null"`
	Public          string `sql:"not null"`
	Private         string `sql:"not null"`
}

GormPrivateKey represents a PrivateKey in the database

func (GormPrivateKey) TableName

func (g GormPrivateKey) TableName() string

TableName sets a specific table name for our GormPrivateKey

type KeyDBStore

type KeyDBStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

KeyDBStore persists and manages private keys on a SQL database

func NewKeyDBStore

func NewKeyDBStore(passphraseRetriever passphrase.Retriever, defaultPassAlias string,
	dbDialect string, dbArgs ...interface{}) (*KeyDBStore, error)

NewKeyDBStore returns a new KeyDBStore backed by a SQL database

func (*KeyDBStore) AddKey

func (s *KeyDBStore) AddKey(name, alias string, privKey data.PrivateKey) error

AddKey stores the contents of a private key. Both name and alias are ignored, we always use Key IDs as name, and don't support aliases

func (*KeyDBStore) ExportKey

func (s *KeyDBStore) ExportKey(name string) ([]byte, error)

ExportKey is currently unimplemented and will always return an error

func (*KeyDBStore) GetKey

func (s *KeyDBStore) GetKey(name string) (data.PrivateKey, string, error)

GetKey returns the PrivateKey given a KeyID

func (*KeyDBStore) HealthCheck

func (s *KeyDBStore) HealthCheck() error

HealthCheck verifies that DB exists and is query-able

func (*KeyDBStore) ImportKey

func (s *KeyDBStore) ImportKey(pemBytes []byte, alias string) error

ImportKey is currently unimplemented and will always return an error

func (*KeyDBStore) ListKeys

func (s *KeyDBStore) ListKeys() map[string]string

ListKeys always returns nil. This method is here to satisfy the KeyStore interface

func (*KeyDBStore) Name

func (s *KeyDBStore) Name() string

Name returns a user friendly name for the storage location

func (*KeyDBStore) RemoveKey

func (s *KeyDBStore) RemoveKey(name string) error

RemoveKey removes the key from the keyfilestore

func (*KeyDBStore) RotateKeyPassphrase

func (s *KeyDBStore) RotateKeyPassphrase(name, newPassphraseAlias string) error

RotateKeyPassphrase rotates the key-encryption-key

Source Files

keydbstore.go

Version
v0.2.0
Published
Feb 25, 2016
Platform
linux/amd64
Imports
8 packages
Last checked
2 hours ago

Tools for package owners.