tlscert

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tlscert gives serve a TLS certificate when it binds beyond loopback: the operator's own (api.tls_cert and api.tls_key), or one it generates once, self-signed, and keeps in the state directory, so its fingerprint stays the same from one start to the next and a client can pin it.

Index

Constants

View Source
const (
	CertFile = "tls-cert.pem"
	KeyFile  = "tls-key.pem"
)

The generated pair, in the state directory.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Config *tls.Config
	// Fingerprint is the SHA-256 of the leaf certificate's DER, as hex pairs
	// separated by colons: what a browser shows and what curl --pinnedpubkey
	// is not (that one hashes the public key; see PublicKeyPin).
	Fingerprint string
	// PublicKeyPin is base64 SHA-256 of the leaf's public key, for curl's
	// --pinnedpubkey "sha256//<pin>".
	PublicKeyPin string
	// Generated is set when the certificate is the tool's own self-signed one,
	// and New when it was made on this start.
	Generated, New bool
	// CertPath is the file it came from.
	CertPath string
}

Result is the certificate serve presents.

func Load

func Load(certPath, keyPath string) (Result, error)

Load reads the operator's certificate and key.

func SelfSigned

func SelfSigned(dir, host string, now time.Time) (Result, error)

SelfSigned returns the generated certificate in dir, making one when there is none, it has expired (or will within a day), or it does not name host.

Jump to

Keyboard shortcuts

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