test_ca

package
v1.116.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package test_ca makes a throwaway certificate hierarchy shaped like a real e-seal's: a root, an issuing CA, a sealing certificate and a timestamping unit, with a CRL from each CA.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authority

type Authority struct {
	Root    *x509.Certificate
	Issuing *x509.Certificate
	Seal    *x509.Certificate
	SealKey crypto.Signer
	Tsa     *x509.Certificate
	// contains filtered or unexported fields
}

Authority is the hierarchy and the sealing key.

func New

func New(now time.Time, organization string) (*Authority, error)

New makes a hierarchy valid from an hour before now for a year, sealing in the name of organization.

func (*Authority) Chain

func (a *Authority) Chain() []*x509.Certificate

Chain is the sealing certificate and its issuing CA, as a signature carries them.

func (*Authority) Crls

func (a *Authority) Crls(now time.Time) ([][]byte, error)

Crls issues an empty CRL from each CA, current at now.

func (*Authority) IssueSeal added in v1.116.0

func (a *Authority) IssueSeal(publicKey crypto.PublicKey) (*x509.Certificate, error)

IssueSeal issues a sealing certificate for a key the authority does not hold, such as one in an HSM, from its issuing CA, valid as long as the authority's own.

func (*Authority) IssueToken

func (a *Authority) IssueToken(digest []byte, nonce *big.Int, at time.Time) ([]byte, error)

IssueToken makes a timestamp token over a SHA-256 digest at the given time.

func (*Authority) RootPem

func (a *Authority) RootPem() []byte

RootPem is the root certificate in PEM, for a validator to trust.

func (*Authority) ServeHTTP

func (a *Authority) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP answers RFC 3161 requests, so the authority can stand in for a TSA over HTTP.

func (*Authority) Timestamp

func (a *Authority) Timestamp(_ context.Context, digest []byte) ([]byte, error)

Timestamp makes the authority a tsa.Timestamper that answers in process.

Jump to

Keyboard shortcuts

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