kms

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type KeyFactory

type KeyFactory struct{}

func (*KeyFactory) NewMasterKey

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

type KeyHandler

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

type MasterKey

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

func NewKmsMasterKey

func NewKmsMasterKey(client model.KMSClient, keyID string) (*MasterKey, error)

func (*MasterKey) DecryptDataKey

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

DecryptDataKey returns DataKey which is decrypted from EncryptedDataKey that was encrypted by EncryptDataKey DataKey contains:

provider			keyID of this (MasterKey) KmsMasterKey MUST equals to EncryptedDataKey keyID
dataKey				Plaintext is decrypted content of EncryptedDataKey encryptedDataKey
encryptedDataKey	encrypted content of (this) EncryptedDataKey

Decrypted dataKey (plaintext) MUST match DataKey (plaintext) that was originally generated at GenerateDataKey.

func (*MasterKey) EncryptDataKey

EncryptDataKey returns EncryptedDataKey which is encrypted from DataKey that was generated at GenerateDataKey EncryptedDataKey contains:

provider			keyID of this (MasterKey) KmsMasterKey
encryptedDataKey	CiphertextBlob is encrypted content of dataKey (this or other)

i.e. GenerateDataKey (encryption material generator), once per primaryMasterKey ->
-> for each MasterKey (KmsMasterKey) registered in providers.MasterKeyProvider do EncryptDataKey

func (*MasterKey) GenerateDataKey

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

GenerateDataKey returns DataKey is generated from primaryMasterKey in MasterKeyProvider DataKey contains:

provider			keyID of this (MasterKey) KmsMasterKey
dataKey				Plaintext of this generated dataKey
encryptedDataKey	CiphertextBlob of this generated dataKey

type MrkKeyFactory

type MrkKeyFactory struct{}

func (*MrkKeyFactory) NewMasterKey

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

type MrkMasterKey

type MrkMasterKey struct {
	MasterKey
}

func NewKmsMrkMasterKey

func NewKmsMrkMasterKey(client model.KMSClient, keyID string) (*MrkMasterKey, error)

func (*MrkMasterKey) DecryptDataKey

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

func (*MrkMasterKey) OwnsDataKey

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

Jump to

Keyboard shortcuts

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