memca

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package memca provides the CertificateAuthority interface entirely in memory without persistence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertificateAuthority

type CertificateAuthority struct {
	Certs map[string]*x509.Certificate

	RootName          string
	PrimarySigningKey string
}

CertificateAuthority implements the certificate authority interface, and can be used as both a mock and a fake given that its internal respresentation is exported.

func Create

func Create() *CertificateAuthority

Create returns a new CertificateAuthority object that's ready for use.

func TestOnlyCertificateAuthority

func TestOnlyCertificateAuthority() *CertificateAuthority

TestOnlyCertificateAuthority returns a CertificateAuthority object that can be used for testing based on pre-generated development keys.

func (*CertificateAuthority) AddFlags

func (ca *CertificateAuthority) AddFlags(*cobra.Command)

AddFlags adds any implementation-specific flags for this command component.

func (*CertificateAuthority) CABundle

func (ca *CertificateAuthority) CABundle(context.Context, string) ([]byte, error)

CABundle returns the PEM-encoded certificate chain for inner intermediates to root for the CertificateAuthority key of the given keyName.

func (*CertificateAuthority) Certificate

func (ca *CertificateAuthority) Certificate(_ context.Context, keyVersionName string) ([]byte, error)

Certificate returns the DER-encoded certificate of the given keyVersionName.

func (*CertificateAuthority) Finalize

Finalize completes any unflushed changes that the given mutation represents. The mutation object should be the same type as NewMutation returns.

func (*CertificateAuthority) InitContext

func (ca *CertificateAuthority) InitContext(ctx context.Context) (context.Context, error)

InitContext extends the given context with whatever else the component needs before execution.

func (*CertificateAuthority) NewMutation

NewMutation returns an object that manages changes to the CA's persistent state.

func (*CertificateAuthority) PersistentPreRunE

func (ca *CertificateAuthority) PersistentPreRunE(*cobra.Command, []string) error

PersistentPreRunE returns an error if the results of the parsed flags constitute an error.

func (*CertificateAuthority) PrepareResources

func (ca *CertificateAuthority) PrepareResources(context.Context) error

PrepareResources ensures all necessary resources are present for the CA to function. This is needed for bootstrapping.

func (*CertificateAuthority) PrimaryRootKeyVersion

func (ca *CertificateAuthority) PrimaryRootKeyVersion(context.Context) (string, error)

PrimaryRootKeyVersion returns the keyVersionName of the active root key.

func (*CertificateAuthority) PrimarySigningKeyVersion

func (ca *CertificateAuthority) PrimarySigningKeyVersion(context.Context) (string, error)

PrimarySigningKeyVersion returns the keyVersionName of the active signing key.

func (*CertificateAuthority) Wipeout

Wipeout destroys all persisted resources for the CA.

type Mutation

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

Mutation represents a memca.CertificateAuthority mutation.

func (*Mutation) AddSigningKeyCert

func (m *Mutation) AddSigningKeyCert(keyVersionName string, cert *x509.Certificate)

AddSigningKeyCert adds a certificate for the given keyVersionName to the CA.

func (*Mutation) SetPrimaryRootKeyVersion

func (m *Mutation) SetPrimaryRootKeyVersion(keyVersionName string)

SetPrimaryRootKeyVersion updates the mutation object to change the primary root key version to the given one.

func (*Mutation) SetPrimarySigningKeyVersion

func (m *Mutation) SetPrimarySigningKeyVersion(keyVersionName string)

SetPrimarySigningKeyVersion updates the mutation object to change the primary signing key version to the given one.

func (*Mutation) SetRootKeyCert

func (m *Mutation) SetRootKeyCert(cert *x509.Certificate)

SetRootKeyCert changes the CA's stored root certificate to cert.

Jump to

Keyboard shortcuts

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