testca

package
v0.0.0-...-645e11a Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package testca provides helpers to create a self-signed CA certificate, and the ability to generate signed certificates from it. PLEASE NOTE THIS IS NOT A PRODUCTION SAFE NOR VERIFIED WAY TO MANAGE CERTIFICATES FOR SERVERS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	KeyPath  string
	CertPath string
	// contains filtered or unexported fields
}

Cert allows the consumer to retrieve the cert and key path, to be used by other processes, like servers for example.

func NewX509

func NewX509(data test.Data, helpers test.Helpers) *Cert

NewX509 creates a new, self-signed, signing certificate under data.Temp()/ca From that Cert as a CA, you can then generate signed certificates. Note that the common name of the cert will be set to the test name.

func (*Cert) GenerateCustomX509

func (ca *Cert) GenerateCustomX509(
	data test.Data,
	helpers test.Helpers,
	underDirectory string,
	template *x509.Certificate,
) *Cert

GenerateCustomX509 signs a random x509 certificate template. Note that if SerialNumber is specified, it must be safe to use on the filesystem as this will be used in the name of the certificate file.

func (*Cert) GenerateServerX509

func (ca *Cert) GenerateServerX509(data test.Data, helpers test.Helpers, host string, additional ...string) *Cert

GenerateServerX509 produces a certificate usable by a server. additional can be used to provide additional ips to be added to the certificate.

Jump to

Keyboard shortcuts

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