kms

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockAESGCMKeyHandle added in v0.1.4

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

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

func CreateMockED25519KeyHandle added in v0.1.4

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
	CreateKeyFn              func(kt kmsservice.KeyType) (string, interface{}, error)
	GetKeyValue              *keyset.Handle
	GetKeyErr                error
	RotateKeyID              string
	RotateKeyValue           *keyset.Handle
	RotateKeyErr             error
	ExportPubKeyBytesErr     error
	ExportPubKeyBytesValue   []byte
	ExportPubKeyTypeValue    kmsservice.KeyType
	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 added in v0.1.4

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

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

func (*KeyManager) ExportPubKeyBytes added in v0.1.4

func (k *KeyManager) ExportPubKeyBytes(keyID string) ([]byte, kmsservice.KeyType, 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 added in v0.1.4

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 added in v0.1.4

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 added in v0.1.3

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

Provider provides mock Provider implementation.

func NewProviderForKMS added in v0.1.4

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

NewProviderForKMS creates a new mock Provider to create a KMS.

func (*Provider) SecretLock added in v0.1.3

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

SecretLock returns a secret lock service.

func (*Provider) StorageProvider added in v0.1.3

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