keydbstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

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

Constants

Variables

This section is empty.

Functions

This section is empty.

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(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error

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

func (*KeyDBStore) ExportKey

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

ExportKey is currently unimplemented and will always return an error

func (*KeyDBStore) GetKey

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

GetKey returns the PrivateKey given a KeyID

func (*KeyDBStore) GetKeyInfo added in v0.3.0

func (s *KeyDBStore) GetKeyInfo(keyID string) (trustmanager.KeyInfo, error)

GetKeyInfo returns the PrivateKey's role and gun in a KeyInfo given a KeyID

func (*KeyDBStore) HealthCheck

func (s *KeyDBStore) HealthCheck() error

HealthCheck verifies that DB exists and is query-able

func (*KeyDBStore) ListKeys

func (s *KeyDBStore) ListKeys() map[string]trustmanager.KeyInfo

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(keyID string) error

RemoveKey removes the key from the keyfilestore

func (*KeyDBStore) RotateKeyPassphrase

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

RotateKeyPassphrase rotates the key-encryption-key

type RDBPrivateKey added in v0.3.0

type RDBPrivateKey struct {
	rethinkdb.Timing
	KeyID           string `gorethink:"key_id"`
	EncryptionAlg   string `gorethink:"encryption_alg"`
	KeywrapAlg      string `gorethink:"keywrap_alg"`
	Algorithm       string `gorethink:"algorithm"`
	PassphraseAlias string `gorethink:"passphrase_alias"`
	Public          string `gorethink:"public"`
	Private         string `gorethink:"private"`
}

RDBPrivateKey represents a PrivateKey in the rethink database

func (RDBPrivateKey) TableName added in v0.3.0

func (g RDBPrivateKey) TableName() string

TableName sets a specific table name for our RDBPrivateKey

type RethinkDBKeyStore added in v0.3.0

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

RethinkDBKeyStore persists and manages private keys on a RethinkDB database

func NewRethinkDBKeyStore added in v0.3.0

func NewRethinkDBKeyStore(dbName string, passphraseRetriever passphrase.Retriever, defaultPassAlias string, rethinkSession *gorethink.Session) *RethinkDBKeyStore

NewRethinkDBKeyStore returns a new RethinkDBKeyStore backed by a RethinkDB database

func (*RethinkDBKeyStore) AddKey added in v0.3.0

func (rdb *RethinkDBKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error

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

func (RethinkDBKeyStore) Bootstrap added in v0.3.0

func (rdb RethinkDBKeyStore) Bootstrap() error

Bootstrap sets up the database and tables

func (RethinkDBKeyStore) CheckHealth added in v0.3.0

func (rdb RethinkDBKeyStore) CheckHealth() error

CheckHealth verifies that DB exists and is query-able

func (RethinkDBKeyStore) ExportKey added in v0.3.0

func (rdb RethinkDBKeyStore) ExportKey(keyID string) ([]byte, error)

ExportKey is currently unimplemented and will always return an error

func (*RethinkDBKeyStore) GetKey added in v0.3.0

func (rdb *RethinkDBKeyStore) GetKey(name string) (data.PrivateKey, string, error)

GetKey returns the PrivateKey given a KeyID

func (RethinkDBKeyStore) GetKeyInfo added in v0.3.0

func (rdb RethinkDBKeyStore) GetKeyInfo(name string) (trustmanager.KeyInfo, error)

GetKeyInfo always returns empty and an error. This method is here to satisfy the KeyStore interface

func (RethinkDBKeyStore) ListKeys added in v0.3.0

func (rdb RethinkDBKeyStore) ListKeys() map[string]trustmanager.KeyInfo

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

func (*RethinkDBKeyStore) Name added in v0.3.0

func (rdb *RethinkDBKeyStore) Name() string

Name returns a user friendly name for the storage location

func (RethinkDBKeyStore) RemoveKey added in v0.3.0

func (rdb RethinkDBKeyStore) RemoveKey(keyID string) error

RemoveKey removes the key from the table

func (RethinkDBKeyStore) RotateKeyPassphrase added in v0.3.0

func (rdb RethinkDBKeyStore) RotateKeyPassphrase(name, newPassphraseAlias string) error

RotateKeyPassphrase rotates the key-encryption-key

Jump to

Keyboard shortcuts

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