kms

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockAESGCMKeyHandle

func CreateMockAESGCMKeyHandle() (*keyset.Handle, error)

CreateMockAESGCMKeyHandle is a utility function that returns a mock key (for tests only, not registered in Tink).

func CreateMockED25519KeyHandle

func CreateMockED25519KeyHandle() (*keyset.Handle, error)

CreateMockED25519KeyHandle is a utility function that returns a mock key (for tests only, not registered in Tink).

Types

type KeyManager

type KeyManager struct {
	CreateKeyID              string
	CreateKeyValue           *keyset.Handle
	CreateKeyErr             error
	GetKeyValue              *keyset.Handle
	GetKeyErr                error
	RotateKeyID              string
	RotateKeyValue           *keyset.Handle
	RotateKeyErr             error
	ExportPubKeyBytesErr     error
	ExportPubKeyBytesValue   []byte
	CrAndExportPubKeyValue   []byte
	CrAndExportPubKeyID      string
	CrAndExportPubKeyErr     error
	PubKeyBytesToHandleErr   error
	PubKeyBytesToHandleValue *keyset.Handle
	ImportPrivateKeyErr      error
	ImportPrivateKeyID       string
	ImportPrivateKeyValue    *keyset.Handle
}

KeyManager mocks a local Key Management Service + ExportableKeyManager.

func (*KeyManager) Create

func (k *KeyManager) Create(kt kmsservice.KeyType) (string, interface{}, error)

Create a new mock ey/keyset/key handle for the type kt.

func (*KeyManager) CreateAndExportPubKeyBytes

func (k *KeyManager) CreateAndExportPubKeyBytes(kt kmsservice.KeyType) (string, []byte, error)

CreateAndExportPubKeyBytes return a mocked kid and []byte public key.

func (*KeyManager) ExportPubKeyBytes

func (k *KeyManager) ExportPubKeyBytes(keyID string) ([]byte, error)

ExportPubKeyBytes will return a mocked []bytes public key.

func (*KeyManager) Get

func (k *KeyManager) Get(keyID string) (interface{}, error)

Get a mock key handle for the given keyID.

func (*KeyManager) ImportPrivateKey

func (k *KeyManager) ImportPrivateKey(privKey interface{}, keyType kmsservice.KeyType,
	opts ...kmsservice.PrivateKeyOpts) (string, interface{}, error)

ImportPrivateKey will emulate importing a private key and returns a mocked keyID, private key handle.

func (*KeyManager) PubKeyBytesToHandle

func (k *KeyManager) PubKeyBytesToHandle(pubKey []byte, keyType kmsservice.KeyType) (interface{}, error)

PubKeyBytesToHandle will return a mocked keyset.Handle representing a public key handle.

func (*KeyManager) Rotate

func (k *KeyManager) Rotate(kt kmsservice.KeyType, keyID string) (string, interface{}, error)

Rotate returns a mocked rotated keyset handle and its ID.

type Provider

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

Provider provides mock Provider implementation.

func NewProviderForKMS

func NewProviderForKMS(storeProvider storage.Provider, secretLock secretlock.Service) *Provider

NewProviderForKMS creates a new mock Provider to create a KMS.

func (*Provider) SecretLock

func (p *Provider) SecretLock() secretlock.Service

SecretLock returns a secret lock service.

func (*Provider) StorageProvider

func (p *Provider) StorageProvider() storage.Provider

StorageProvider return a storage provider.

Jump to

Keyboard shortcuts

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