kms

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package kms contains KMS and KMS MRK Master Key implementations.

Index

Constants

This section is empty.

Variables

View Source
var ErrKmsClient = errors.New("KMSClient error")

ErrKmsClient is returned when AWS KMS encounters an error.

Functions

This section is empty.

Types

type KeyFactory

type KeyFactory struct{}

KeyFactory is a factory for creating Kms MasterKey.

func (*KeyFactory) NewMasterKey

func (f *KeyFactory) NewMasterKey(args ...interface{}) (model.MasterKey, error)

NewMasterKey factory method returns a new instance of Kms MasterKey.

type KeyHandler

type KeyHandler interface {
	model.MasterKey
	// contains filtered or unexported methods
}

KeyHandler is an interface specific to the Kms MasterKey which is used by the KmsMasterKeyProvider.

type MasterKey

type MasterKey struct {
	keys.BaseKey
	// contains filtered or unexported fields
}

MasterKey contains the Kms Master Key, KMS Client, and it implements the model.MasterKey interface.

func (*MasterKey) DecryptDataKey

func (kmsMK *MasterKey) DecryptDataKey(ctx context.Context, encryptedDataKey model.EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (model.DataKeyI, error)

DecryptDataKey decrypts the encrypted data key and returns the data key.

func (*MasterKey) EncryptDataKey

EncryptDataKey encrypts the data key and returns the encrypted data key.

func (*MasterKey) GenerateDataKey

func (kmsMK *MasterKey) GenerateDataKey(ctx context.Context, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (model.DataKeyI, error)

GenerateDataKey generates a new data key and returns it.

type MrkKeyFactory

type MrkKeyFactory struct{}

MrkKeyFactory is a factory for creating Kms MrkMasterKey.

func (*MrkKeyFactory) NewMasterKey

func (f *MrkKeyFactory) NewMasterKey(args ...interface{}) (model.MasterKey, error)

NewMasterKey factory method returns a new instance of Kms MrkMasterKey.

type MrkMasterKey

type MrkMasterKey struct {
	MasterKey
}

MrkMasterKey is a Kms MasterKey that uses a KMS multi-Region key. It embeds the Kms MasterKey and implements the Kms KeyHandler interface.

func (*MrkMasterKey) DecryptDataKey

func (kmsMrkMK *MrkMasterKey) DecryptDataKey(ctx context.Context, encryptedDataKey model.EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (model.DataKeyI, error)

DecryptDataKey decrypts the encrypted data key and returns the data key.

func (*MrkMasterKey) OwnsDataKey

func (kmsMrkMK *MrkMasterKey) OwnsDataKey(key model.Key) bool

OwnsDataKey checks if the key resource ARN matches the keyID of the master key. Both ARNs must be MRK ARNs.

Jump to

Keyboard shortcuts

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