pins

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 10 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 pins checks connections against the root package's Config.Pins (decision 0032): it parses the pins, finds the one covering a host, matches it against a verified chain, and lists a chain's pins for FetchPins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Presented

func Presented(cs tls.ConnectionState) []string

Presented is the first verified chain's (else the peer's) keys as "sha256/<base64>" pins, leaf first.

Types

type Cert

type Cert struct {
	Role        Role
	Subject     string
	Issuer      string
	NotAfter    time.Time
	SPKI        string
	SPKIHex     string
	Fingerprint string
}

Cert is a certificate of a verified chain and the values that pin it: the root's CertPin.

func Chain

func Chain(cs *tls.ConnectionState) ([]Cert, error)

Chain returns cs's first verified chain, leaf first, with its pins.

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry is a parsed Pin: the SHA-256 hashes it accepts, of keys and of whole certificates.

func (*Entry) Matches

func (e *Entry) Matches(cs tls.ConnectionState) bool

Matches reports whether a certificate of one of cs's verified chains has a key or fingerprint e accepts.

type Pin

type Pin struct {
	Host              string
	IncludeSubdomains bool
	SPKI              []string
}

Pin pins a host (and, with IncludeSubdomains, its subdomains) to public keys: the root's Pin, which converts to it.

type Role

type Role int

Role is a certificate's place in a verified chain: the root's CertRole, with the same values.

const (
	Leaf Role = iota
	Intermediate
	Root
)

Roles: a chain runs from the leaf through intermediates to its root.

type Set

type Set map[string]*Entry

Set is the root's Config.Pins by host.

func Parse

func Parse(pins []Pin) (Set, error)

Parse checks and parses pins.

func (Set) Lookup

func (s Set) Lookup(host string) *Entry

Lookup returns the entry covering host: its own, else the nearest parent's that includes subdomains; nil when none does.

Jump to

Keyboard shortcuts

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