Documentation
¶
Index ¶
- func CreateMockAESGCMKeyHandle() (*keyset.Handle, error)
- func CreateMockED25519KeyHandle() (*keyset.Handle, error)
- type KeyManager
- func (k *KeyManager) Create(kt kms.KeyType, opts ...kms.KeyOpts) (string, interface{}, error)
- func (k *KeyManager) CreateAndExportPubKeyBytes(kt kms.KeyType, opts ...kms.KeyOpts) (string, []byte, error)
- func (k *KeyManager) ExportPubKeyBytes(keyID string) ([]byte, kms.KeyType, error)
- func (k *KeyManager) Get(keyID string) (interface{}, error)
- func (k *KeyManager) ImportPrivateKey(privKey interface{}, keyType kms.KeyType, opts ...kms.PrivateKeyOpts) (string, interface{}, error)
- func (k *KeyManager) PubKeyBytesToHandle(pubKey []byte, keyType kms.KeyType, opts ...kms.KeyOpts) (interface{}, error)
- func (k *KeyManager) Rotate(kt kms.KeyType, keyID string, opts ...kms.KeyOpts) (string, interface{}, error)
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMockAESGCMKeyHandle ¶
CreateMockAESGCMKeyHandle is a utility function that returns a mock key (for tests only, not registered in Tink).
func CreateMockED25519KeyHandle ¶
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 kms.KeyType) (string, interface{}, error)
GetKeyValue *keyset.Handle
GetKeyErr error
RotateKeyID string
RotateKeyValue *keyset.Handle
RotateKeyErr error
ExportPubKeyBytesErr error
ExportPubKeyBytesValue []byte
ExportPubKeyTypeValue kms.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) CreateAndExportPubKeyBytes ¶
func (k *KeyManager) CreateAndExportPubKeyBytes(kt kms.KeyType, opts ...kms.KeyOpts) (string, []byte, error)
CreateAndExportPubKeyBytes return a mocked kid and []byte public key.
func (*KeyManager) ExportPubKeyBytes ¶
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 kms.KeyType, opts ...kms.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 kms.KeyType, opts ...kms.KeyOpts) (interface{}, error)
PubKeyBytesToHandle will return a mocked keyset.Handle representing a public key handle.
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, error)
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 ¶
StorageProvider return a storage provider.