keymanagementprovider

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCertificates

func DecodeCertificates(value []byte) ([]*x509.Certificate, error)

DecodeCertificates decodes PEM-encoded bytes into an x509.Certificate chain.

func DecodeKey

func DecodeKey(value []byte) (crypto.PublicKey, error)

DecodeKey takes in a PEM encoded byte array and returns a public key PEM encoded byte array is expected to be a single public key. If multiple are provided, the first one is returned

func DeleteResourceFromMap

func DeleteResourceFromMap(resource string)

DeleteResourceFromMap deletes the certificates, keys and errors from the map it is concurrency-safe

func FlattenKMPMap

func FlattenKMPMap(certMap map[KMPMapKey][]*x509.Certificate) []*x509.Certificate

FlattenKMPMap flattens the map of certificates fetched for a single key management provider resource and returns a single array

func GetCertificatesFromMap

func GetCertificatesFromMap(ctx context.Context, resource string) (map[KMPMapKey][]*x509.Certificate, error)

GetCertificatesFromMap gets the certificates from the map and returns an empty map of certificate arrays if not found or an error happened.

func GetKeysFromMap

func GetKeysFromMap(ctx context.Context, resource string) (map[KMPMapKey]PublicKey, error)

GetKeysFromMap gets the keys from the map and returns an empty map if not found or an error happened.

func SaveSecrets

func SaveSecrets(resource, providerType string, keys map[KMPMapKey]crypto.PublicKey, certs map[KMPMapKey][]*x509.Certificate)

SaveSecrets saves the keys and certificates in the map.

func SetCertificateError

func SetCertificateError(resource string, err error)

SetCertificateError sets the error while fetching certificates from key management provider.

func SetKeyError

func SetKeyError(resource string, err error)

SetKeyError sets the error while fetching keys from key management provider.

Types

type KMPMapKey

type KMPMapKey struct {
	Name    string
	Version string
}

KMPMapKey is a key for the map of certificates fetched for a single key management provider resource

type KeyManagementProvider

type KeyManagementProvider interface {
	// Returns an array of certificates and the provider specific cert attributes
	GetCertificates(ctx context.Context) (map[KMPMapKey][]*x509.Certificate, KeyManagementProviderStatus, error)
	// Returns an array of keys and the provider specific key attributes
	GetKeys(ctx context.Context) (map[KMPMapKey]crypto.PublicKey, KeyManagementProviderStatus, error)
	// Returns if the provider supports refreshing of certificates/keys
	IsRefreshable() bool
}

KeyManagementProvider is an interface that defines methods to be implemented by a each key management provider provider

type KeyManagementProviderStatus

type KeyManagementProviderStatus map[string]interface{}

This is a map of properties for fetched certificates/keys The key and values are specific to each provider

type PublicKey

type PublicKey struct {
	Key          crypto.PublicKey
	ProviderType string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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