pkp

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingAlgorithm     = errors.New("missing algorithm")
	ErrUnsupportedAlgorithm = errors.New("unsupported algorithm")
	ErrMalformedPin         = errors.New("malformed pin")
)
View Source
var (
	ErrNoPins               = errors.New("no pins provided")
	ErrCertValidationFailed = errors.New("peer certificate validation failed")
)

Functions

func TLSConfig

func TLSConfig(pins []*PublicKeyPin) (*tls.Config, error)

Types

type Alg

type Alg string
const (
	AlgSHA256 Alg = "sha256"
	AlgB2B256 Alg = "b2b256"
)

type PublicKeyPin

type PublicKeyPin struct {
	Algorithm   Alg    `json:"alg"`
	Fingerprint []byte `json:"fingerprint"`
}

func DecodePin

func DecodePin(pin string) (*PublicKeyPin, error)

func New

func New(cert *x509.Certificate, alg Alg) (*PublicKeyPin, error)

func NewBlake2b256

func NewBlake2b256(cert *x509.Certificate) *PublicKeyPin

func NewSha256

func NewSha256(cert *x509.Certificate) *PublicKeyPin

func (*PublicKeyPin) DeepCopy

func (p *PublicKeyPin) DeepCopy() *PublicKeyPin

func (*PublicKeyPin) Encode

func (p *PublicKeyPin) Encode() string

func (*PublicKeyPin) Equal

func (p *PublicKeyPin) Equal(other *PublicKeyPin) bool

func (*PublicKeyPin) Validate

func (p *PublicKeyPin) Validate() error

Jump to

Keyboard shortcuts

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