simpki

package
v0.0.0-...-90ffb0e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package simpki allows to simulate a PKI for testing purposes.

It allows to generate self-signed certificates and to cache them in a directory to avoid regenerating them at every run.

Because this package is only meant to run as part of integration tests, all the functions panic on failure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = selfsignedcert.Config

Config is an alias for selfsignedcert.Config.

type PKI

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

PKI models the public key infrastructure.

Construct using [NewPKI].

func MustNew

func MustNew(cacheDir string) *PKI

MustNew constructs a new *PKI instance using the given filesystem directory to store the certificates, to avoid regenerating them every time we run integration tests.

This function panics on failure.

func (*PKI) CertPool

func (pki *PKI) CertPool() *x509.CertPool

CertPool returns the certificate pool that contains all the certificates generated by this PKI.

func (*PKI) MustNewCert

func (pki *PKI) MustNewCert(config *Config) tls.Certificate

MustNewCert creates the certificate using the given *Config and using the cache directory to avoid regenerating the certificate every time.

It returns the tls.Certificate to use in server code.

As a side effect, this method also updates the certificate pool you can get with *PKI.CertPool.

This function panics on failure.

Jump to

Keyboard shortcuts

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