localca

package
v1.5.1-0...-956f000 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package localca implements a localca that is useful for testing the transport package. To use the localca, see the New and Load functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleRequest

func ExampleRequest() *csr.CertificateRequest

ExampleRequest can be used as a sample request, or the returned request can be modified.

func ExampleSigningConfig

func ExampleSigningConfig() *config.Signing

ExampleSigningConfig returns a sample config.Signing with only a default profile.

func Load

func Load(lca *CA, profiles *config.Signing) (err error)

Load reads the key and certificate from the files specified in the CA.

Types

type CA

type CA struct {

	// Label and Profile are used to select the CFSSL signer
	// components if they should be anything but the default.
	Label   string `json:"label"`
	Profile string `json:"profile"`

	// The KeyFile and CertFile are required when using Load to
	// construct a CA.
	KeyFile  string `json:"private_key,omitempty"`
	CertFile string `json:"certificate,omitempty"`
	// contains filtered or unexported fields
}

CA is a local transport CertificateAuthority that is useful for tests.

func New

func New(req *csr.CertificateRequest, profiles *config.Signing) (*CA, error)

New generates a new CA from a certificate request and signing profile.

func NewFromSigner

func NewFromSigner(s *local.Signer) *CA

NewFromSigner constructs a local CA from a CFSSL signer.

func (*CA) CACertificate

func (lca *CA) CACertificate() ([]byte, error)

CACertificate returns the certificate authority's certificate.

func (*CA) SignCSR

func (lca *CA) SignCSR(csrPEM []byte) ([]byte, error)

SignCSR submits a PKCS #10 certificate signing request to a CA for signing.

func (*CA) Toggle

func (lca *CA) Toggle()

Toggle switches the CA between operable mode and inoperable mode. This is useful in testing to verify behaviours when a CA is unavailable.

Jump to

Keyboard shortcuts

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