certmanager

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package certmanager implements an X509 certificate manager that can replace https://pkg.go.dev/golang.org/x/crypto/acme/autocert#Manager for testing purposes. This certificate manager is a self-signed certificate authority that is not and should not be trusted for securing any real life communication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertManager

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

CertManager is an X509 certificate manager that also acts as a certificate authority for testing purposes.

func New

func New(name string, logger func(string, ...interface{})) (*CertManager, error)

New returns a new ephemeral certificate manager.

func (*CertManager) GetCert

func (cm *CertManager) GetCert(name string) (*tls.Certificate, error)

GetCert returns a new tls.Certificate with name as the subject's common name.

func (*CertManager) GetCertificate

func (cm *CertManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate can be used in tls.Config.

func (*CertManager) HTTPHandler

func (cm *CertManager) HTTPHandler(fallback http.Handler) http.Handler

HTTPHandler returns its fallback arguments. It exists only to mimic the autocert API.

func (*CertManager) RootCACertPool

func (cm *CertManager) RootCACertPool() *x509.CertPool

RootCACertPool returns a CertPool that contains the root certificate.

func (*CertManager) RootCAPEM

func (cm *CertManager) RootCAPEM() string

RootCAPEM returns the root certificate in PEM format.

func (*CertManager) TLSConfig

func (cm *CertManager) TLSConfig() *tls.Config

TLSConfig returns a tls.Config that uses this certificate manager.

Jump to

Keyboard shortcuts

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