keysvc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKeyServiceFn

func AddKeyServiceFn(name string, fn func() (KeyServiceProvider, error))

func DecodeEncrypted

func DecodeEncrypted(data []byte) (encryptedData, error)

Types

type Key

type Key struct {
	ID         uuid.UUID
	Alias      string
	Ciphertext []byte
	Plaintext  []byte
	Type       string
	Context    map[string]string
}

func GenerateDatakey

func GenerateDatakey(alias string, masterKey string, context map[string]string) (*Key, error)

func NewKey

func NewKey(alias string, keyType string, ciphertext []byte, context map[string]string) *Key

NewKey builds a new key with the given alias / encrypted data key

func (*Key) Decrypt

func (key *Key) Decrypt(data []byte) ([]byte, error)

func (*Key) DecryptEncryptedItem

func (key *Key) DecryptEncryptedItem(encrypted encryptedData) ([]byte, error)

func (*Key) EncryptBytes

func (key *Key) EncryptBytes(data []byte) ([]byte, error)

func (*Key) MarshalYAML

func (key *Key) MarshalYAML() (interface{}, error)

func (*Key) UnmarshalYAML

func (key *Key) UnmarshalYAML(unmarshal func(v interface{}) error) error

type KeyServiceProvider

type KeyServiceProvider interface {
	GenerateDatakey(master string, context map[string]string) ([]byte, error)
	DecryptDatakey(ciphertext *[]byte, plaintext *[]byte, context map[string]string) error
}

func GetKeyService

func GetKeyService(name string) (KeyServiceProvider, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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