pkitest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package pkitest makes a throwaway certificate authority for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PKI

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

PKI is a CA that signs the certificates of a test.

func New

func New(t *testing.T) *PKI

New creates a CA in the temporary directory of the test.

func (*PKI) Client

func (p *PKI) Client(t *testing.T, name string) Pair

Client issues a client certificate.

func (*PKI) Server

func (p *PKI) Server(t *testing.T, name string) Pair

Server issues a certificate for 127.0.0.1 and localhost, valid for a day.

func (*PKI) ServerFor

func (p *PKI) ServerFor(t *testing.T, name string, valid time.Duration) Pair

ServerFor is Server with the time the certificate stays valid.

type Pair

type Pair struct{ CertFile, KeyFile string }

Pair is a certificate and its key, as files.

Jump to

Keyboard shortcuts

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