certificate

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	UpgradeAttemptAfter time.Duration
	CertificateSubject  pkix.Name
	CertificateValidity time.Duration
	LogDowngrade        func(isDowngrade bool, hash string) // will be called on downgrade/upgrades
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(key *rsa.PrivateKey, organisationName string) *Generator

NewGenerator generates certificates valid for 2 years (starting January 1st). By default it serves the most recent certificate, but it can be temporarly "Downgraded" to provide the certificate from previous year (which is still valid thanks to the 2-year).

func (*Generator) DER

func (cg *Generator) DER(year int) ([]byte, error)

func (*Generator) Downgrade

func (cg *Generator) Downgrade() bool

Downgrade will serve the previous certificate if not downgraded yet (and return true). Calling it again will cancel the downgrade and return false.

func (*Generator) Hash

func (cg *Generator) Hash() (string, error)

func (*Generator) IsDowngraded

func (cg *Generator) IsDowngraded() bool

func (*Generator) ServeDER added in v0.3.3

func (cg *Generator) ServeDER(w http.ResponseWriter, r *http.Request) error

ServeDER will serve the current public certificate as DER. You can get the previous version, by adding a "?old" query parameter

Jump to

Keyboard shortcuts

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