materials

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: 14 Imported by: 9

Documentation

Overview

Package materials provides CryptoMaterialsManager implementations.

The cryptographic materials manager (CMM) assembles the cryptographic materials that are used to encrypt and decrypt data.

Supported Cryptographic Materials Managers

Usage

The following example demonstrates how to use the DefaultCryptoMaterialsManager.

 // Set up your key provider.
 cmm, err := materials.NewDefault(keyProvider)
 if err != nil {
	  panic("materials manager setup failed") // handle error
 }

Check example for more advanced usage.

Index

Constants

View Source
const EcPublicKeyField = "aws-crypto-public-key"

EcPublicKeyField is the reserved field name in encryption context that represents the public verification key.

Variables

View Source
var ErrCMM = errors.New("CMM error")

ErrCMM is a generic model.CryptoMaterialsManager error.

Functions

This section is empty.

Types

type BaseCache

type BaseCache interface {
	PutEncryptionEntry(cacheKey []byte, m model.EncryptionMaterials, n int) (*CacheEntry[model.EncryptionMaterials], error)
	PutDecryptionEntry(cacheKey []byte, m model.DecryptionMaterials) (*CacheEntry[model.DecryptionMaterials], error)
	GetEncryptionEntry(cacheKey []byte, n int) (*CacheEntry[model.EncryptionMaterials], error)
	GetDecryptionEntry(cacheKey []byte) (*CacheEntry[model.DecryptionMaterials], error)
}

BaseCache CachingCryptoMaterialsManager still under development.

type CacheEntry

type CacheEntry[V model.EncryptionMaterials | model.DecryptionMaterials] struct {
	// contains filtered or unexported fields
}

CacheEntry CachingCryptoMaterialsManager still under development.

func NewCacheEntry

func NewCacheEntry[V model.EncryptionMaterials | model.DecryptionMaterials](key []byte, value V, lifetime time.Duration) *CacheEntry[V]

NewCacheEntry CachingCryptoMaterialsManager still under development.

func (*CacheEntry[V]) Age

func (ce *CacheEntry[V]) Age() float64

func (*CacheEntry[V]) IsTooOld

func (ce *CacheEntry[V]) IsTooOld() bool

func (*CacheEntry[V]) Key

func (ce *CacheEntry[V]) Key() []byte

func (*CacheEntry[V]) Value

func (ce *CacheEntry[V]) Value() V

type CachingCryptoMaterialsManager

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

CachingCryptoMaterialsManager still under development.

func NewCaching

NewCaching CachingCryptoMaterialsManager still under development.

func (*CachingCryptoMaterialsManager) DecryptMaterials

DecryptMaterials CachingCryptoMaterialsManager still under development.

func (*CachingCryptoMaterialsManager) GetEncryptionMaterials

GetEncryptionMaterials CachingCryptoMaterialsManager still under development.

func (*CachingCryptoMaterialsManager) GetInstance

GetInstance CachingCryptoMaterialsManager still under development.

type DefaultCryptoMaterialsManager

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

DefaultCryptoMaterialsManager is a default implementation of model.CryptoMaterialsManager. It interacts directly with your Master Key Providers without any caching.

func NewDefault

NewDefault creates a new instance of DefaultCryptoMaterialsManager.

It takes a primary model.MasterKeyProvider and an optional list of extra MasterKeyProviders as parameters. If the primary MasterKeyProvider is nil, it returns an error.

Parameters:

func (*DefaultCryptoMaterialsManager) DecryptMaterials

DecryptMaterials returns the decryption materials for the given request. Used during decryption process to get the decryption materials from registered master key providers.

func (*DefaultCryptoMaterialsManager) GetEncryptionMaterials

GetEncryptionMaterials returns the encryption materials for the given request. Used during encryption process to get the encryption materials from registered master key providers.

func (*DefaultCryptoMaterialsManager) GetInstance

GetInstance returns a new instance of the crypto materials manager to interact within encryption/decryption process.

type MemoryCache

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

MemoryCache CachingCryptoMaterialsManager still under development.

func (*MemoryCache) GetDecryptionEntry

func (mc *MemoryCache) GetDecryptionEntry(key []byte) (*CacheEntry[model.DecryptionMaterials], error)

func (*MemoryCache) GetEncryptionEntry

func (mc *MemoryCache) GetEncryptionEntry(key []byte, _ int) (*CacheEntry[model.EncryptionMaterials], error)

func (*MemoryCache) PutDecryptionEntry

func (mc *MemoryCache) PutDecryptionEntry(key []byte, dm model.DecryptionMaterials) (*CacheEntry[model.DecryptionMaterials], error)

func (*MemoryCache) PutEncryptionEntry

func (mc *MemoryCache) PutEncryptionEntry(key []byte, em model.EncryptionMaterials, _ int) (*CacheEntry[model.EncryptionMaterials], error)

Jump to

Keyboard shortcuts

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