legacykms

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockProvider

func NewMockProvider(kp ...*cryptoutil.MessagingKeys) (*mockprovider.Provider, error)

NewMockProvider will create a new mock LegacyKMS Provider that builds a LegacyKMS with the keypairs list kp

Types

type CloseableKMS

type CloseableKMS struct {
	CreateEncryptionKeyValue string
	CreateKeyErr             error
	CreateSigningKeyValue    string
	FindVerKeyValue          int
	FindVerKeyErr            error
	SignMessageValue         []byte
	SignMessageErr           error
	DecryptMessageValue      []byte
	DecryptMessageErr        error
	PackValue                []byte
	PackErr                  error
	UnpackValue              *transport.Envelope
	UnpackErr                error
	MockDID                  *did.Doc
	EncryptionKeyValue       []byte
	EncryptionKeyErr         error
}

CloseableKMS mock Key Management Service (LegacyKMS)

func (*CloseableKMS) Close

func (m *CloseableKMS) Close() error

Close previously-opened LegacyKMS, removing it if so configured.

func (*CloseableKMS) ConvertToEncryptionKey

func (m *CloseableKMS) ConvertToEncryptionKey(key []byte) ([]byte, error)

ConvertToEncryptionKey converts the keypair containing the given verkey to an encryption keypair

func (*CloseableKMS) CreateKeySet

func (m *CloseableKMS) CreateKeySet() (string, string, error)

CreateKeySet create a new public/private encryption and signature key pairs combo.

func (*CloseableKMS) DeriveKEK

func (m *CloseableKMS) DeriveKEK(alg, apu, fromKey, toPubKey []byte) ([]byte, error)

DeriveKEK derives a key encryption key from two keys mocked to return empty derived KEK

func (*CloseableKMS) FindVerKey

func (m *CloseableKMS) FindVerKey(candidateKeys []string) (int, error)

FindVerKey return a verification key from the list of candidates

func (*CloseableKMS) GetEncryptionKey

func (m *CloseableKMS) GetEncryptionKey(verKey []byte) ([]byte, error)

GetEncryptionKey will return the public encryption key corresponding to the public verKey argument

func (*CloseableKMS) SignMessage

func (m *CloseableKMS) SignMessage(message []byte, fromVerKey string) ([]byte, error)

SignMessage sign a message using the private key associated with a given verification key.

Jump to

Keyboard shortcuts

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