Documentation ¶
Overview ¶
Package memca provides the CertificateAuthority interface entirely in memory without persistence.
Index ¶
- type CertificateAuthority
- func (ca *CertificateAuthority) AddFlags(*cobra.Command)
- func (ca *CertificateAuthority) CABundle(context.Context, string) ([]byte, error)
- func (ca *CertificateAuthority) Certificate(_ context.Context, keyVersionName string) ([]byte, error)
- func (ca *CertificateAuthority) Finalize(context.Context, styp.CertificateAuthorityMutation) error
- func (ca *CertificateAuthority) InitContext(ctx context.Context) (context.Context, error)
- func (ca *CertificateAuthority) NewMutation() styp.CertificateAuthorityMutation
- func (ca *CertificateAuthority) PersistentPreRunE(*cobra.Command, []string) error
- func (ca *CertificateAuthority) PrepareResources(context.Context) error
- func (ca *CertificateAuthority) PrimaryRootKeyVersion(context.Context) (string, error)
- func (ca *CertificateAuthority) PrimarySigningKeyVersion(context.Context) (string, error)
- func (ca *CertificateAuthority) Wipeout(context.Context) error
- type Mutation
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 ¶
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 ¶
func (ca *CertificateAuthority) Finalize(context.Context, styp.CertificateAuthorityMutation) error
Finalize completes any unflushed changes that the given mutation represents. The mutation object should be the same type as NewMutation returns.
func (*CertificateAuthority) InitContext ¶
InitContext extends the given context with whatever else the component needs before execution.
func (*CertificateAuthority) NewMutation ¶
func (ca *CertificateAuthority) NewMutation() styp.CertificateAuthorityMutation
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.
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 ¶
SetPrimaryRootKeyVersion updates the mutation object to change the primary root key version to the given one.
func (*Mutation) SetPrimarySigningKeyVersion ¶
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.