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 PKI ¶
type PKI struct {
// contains filtered or unexported fields
}
PKI models the public key infrastructure.
Construct using [NewPKI].
func MustNew ¶
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 ¶
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.