model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseKeyProvider

type BaseKeyProvider interface {
	ID() string
	Kind() types.ProviderKind
	VendOnDecrypt() bool
	DecryptDataKey(ctx context.Context, MKP MasterKeyProvider, encryptedDataKey EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (DataKeyI, error)
	DecryptDataKeyFromList(ctx context.Context, MKP MasterKeyProvider, encryptedDataKeys []EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (DataKeyI, error)
}

type CryptoMaterialsManager

type CryptoMaterialsManager interface {
	GetEncryptionMaterials(ctx context.Context, request EncryptionMaterialsRequest) (EncryptionMaterial, error)
	DecryptMaterials(ctx context.Context, request DecryptionMaterialsRequest) (DecryptionMaterial, error)
	GetInstance() CryptoMaterialsManager // TODO research and test
}

type DataKey

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

func NewDataKey

func NewDataKey(provider KeyMeta, dataKey, encryptedDataKey []byte) *DataKey

func (DataKey) DataKey

func (dk DataKey) DataKey() []byte

func (DataKey) EncryptedDataKey

func (dk DataKey) EncryptedDataKey() []byte

func (DataKey) KeyID

func (dk DataKey) KeyID() string

func (DataKey) KeyProvider

func (dk DataKey) KeyProvider() KeyMeta

type DataKeyI

type DataKeyI interface {
	Key

	EncryptedDataKey() []byte
	DataKey() []byte
}

type DecryptionMaterial

type DecryptionMaterial interface {
	DataKey() DataKeyI
	VerificationKey() []byte
}

type DecryptionMaterials

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

func NewDecryptionMaterials

func NewDecryptionMaterials(dataKey DataKeyI, verificationKey []byte) *DecryptionMaterials

func (DecryptionMaterials) DataKey

func (d DecryptionMaterials) DataKey() DataKeyI

func (DecryptionMaterials) VerificationKey

func (d DecryptionMaterials) VerificationKey() []byte

type DecryptionMaterialsRequest

type DecryptionMaterialsRequest struct {
	Algorithm         *suite.AlgorithmSuite
	EncryptedDataKeys []EncryptedDataKeyI
	EncryptionContext suite.EncryptionContext
}

type EncryptedDataKey

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

func NewEncryptedDataKey

func NewEncryptedDataKey(provider KeyMeta, encryptedDataKey []byte) *EncryptedDataKey

func (EncryptedDataKey) EncryptedDataKey

func (edk EncryptedDataKey) EncryptedDataKey() []byte

func (EncryptedDataKey) KeyID

func (edk EncryptedDataKey) KeyID() string

func (EncryptedDataKey) KeyProvider

func (edk EncryptedDataKey) KeyProvider() KeyMeta

type EncryptedDataKeyI

type EncryptedDataKeyI interface {
	Key
	EncryptedDataKey() []byte
}

type EncryptionMaterial

type EncryptionMaterial interface {
	DataEncryptionKey() DataKeyI
	EncryptedDataKeys() []EncryptedDataKeyI
	EncryptionContext() suite.EncryptionContext
	SigningKey() *ecdsa.PrivateKey
}

type EncryptionMaterials

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

func NewEncryptionMaterials

func NewEncryptionMaterials(dataEncryptionKey DataKeyI, encryptedDataKeys []EncryptedDataKeyI, ec suite.EncryptionContext, signingKey *ecdsa.PrivateKey) *EncryptionMaterials

func (EncryptionMaterials) DataEncryptionKey

func (e EncryptionMaterials) DataEncryptionKey() DataKeyI

func (EncryptionMaterials) EncryptedDataKeys

func (e EncryptionMaterials) EncryptedDataKeys() []EncryptedDataKeyI

func (EncryptionMaterials) EncryptionContext

func (e EncryptionMaterials) EncryptionContext() suite.EncryptionContext

func (EncryptionMaterials) SigningKey

func (e EncryptionMaterials) SigningKey() *ecdsa.PrivateKey

type EncryptionMaterialsRequest

type EncryptionMaterialsRequest struct {
	EncryptionContext suite.EncryptionContext
	Algorithm         *suite.AlgorithmSuite
	PlaintextLength   int
}

type KMSClient

type KMSClient interface {
	GenerateDataKey(ctx context.Context, params *kms.GenerateDataKeyInput, optFns ...func(*kms.Options)) (*kms.GenerateDataKeyOutput, error)
	Encrypt(ctx context.Context, params *kms.EncryptInput, optFns ...func(*kms.Options)) (*kms.EncryptOutput, error)
	Decrypt(ctx context.Context, params *kms.DecryptInput, optFns ...func(*kms.Options)) (*kms.DecryptOutput, error)
}

type KMSClientFactory

type KMSClientFactory interface {
	NewFromConfig(cfg aws.Config, optFns ...func(options *kms.Options)) KMSClient
}

type Key

type Key interface {
	KeyBase
}

type KeyBase

type KeyBase interface {
	KeyProvider() KeyMeta
	KeyID() string
}

type KeyMeta

type KeyMeta struct {
	ProviderID string
	KeyID      string
}

func WithKeyMeta

func WithKeyMeta(providerID, keyID string) KeyMeta

func (KeyMeta) Equal

func (km KeyMeta) Equal(other KeyMeta) bool

func (KeyMeta) String

func (km KeyMeta) String() string

type MasterKey

type MasterKey interface {
	MasterKeyBase
	GenerateDataKey(ctx context.Context, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (DataKeyI, error)
	EncryptDataKey(ctx context.Context, dataKey DataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (EncryptedDataKeyI, error)
	DecryptDataKey(ctx context.Context, encryptedDataKey EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (DataKeyI, error)
}

type MasterKeyBase

type MasterKeyBase interface {
	KeyID() string
	Metadata() KeyMeta
	OwnsDataKey(key Key) bool
}

type MasterKeyFactory

type MasterKeyFactory interface {
	NewMasterKey(args ...interface{}) (MasterKey, error)
}

type MasterKeyProvider

type MasterKeyProvider interface {
	ProviderBase

	AddMasterKey(keyID string) (MasterKey, error)
	NewMasterKey(ctx context.Context, keyID string) (MasterKey, error)
	MasterKeysForEncryption(ctx context.Context, ec suite.EncryptionContext) (MasterKey, []MasterKey, error)
	MasterKeyForDecrypt(ctx context.Context, metadata KeyMeta) (MasterKey, error)
	DecryptDataKey(ctx context.Context, encryptedDataKey EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (DataKeyI, error)
	DecryptDataKeyFromList(ctx context.Context, encryptedDataKeys []EncryptedDataKeyI, alg *suite.AlgorithmSuite, ec suite.EncryptionContext) (DataKeyI, error)
	ValidateMasterKey(keyID string) error
	MasterKeysForDecryption() []MasterKey
}

type ProviderBase

type ProviderBase interface {
	ProviderKind() types.ProviderKind
	ProviderID() string
	ValidateProviderID(otherID string) error
}

type Wrapper

type Wrapper interface {
	SerializeEncryptedDataKey(encryptedKey, tag, iv []byte) []byte
	DeserializeEncryptedDataKey(b []byte, iVLen int) (encryptedData, iv []byte)
	SerializeKeyInfoPrefix(keyID string) []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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