buffer

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package buffer provides helpers to decode PEM files, populate a tls.StoreWriter, and work with key and cert sets

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCertSet

func InitCertSet(out *CertSet, certs ...*tls.Certificate) error

InitCertSet initializes a preallocated CertSet.

func InitKeySet

func InitKeySet(out *KeySet, keys ...x509utils.PrivateKey) error

InitKeySet initializes a preallocated KeySet.

func MustInitCertSet

func MustInitCertSet(out *CertSet, certs ...*tls.Certificate)

MustInitCertSet is like InitCertSet but panics on errors.

func MustInitKeySet

func MustInitKeySet(out *KeySet, keys ...x509utils.PrivateKey)

MustInitKeySet is like InitKeySet but panics on errors.

Types

type CertSet

type CertSet struct {
	set.Set[*x509.Certificate, certpool.Hash, *tls.Certificate]
}

CertSet keeps a thread-safe set of unique [tls.Certificate]s.

func MustCertSet

func MustCertSet(certs ...*tls.Certificate) *CertSet

MustCertSet is like NewCertSet but panics on errors.

func NewCertSet

func NewCertSet(certs ...*tls.Certificate) (*CertSet, error)

NewCertSet creates a CertSet optionally taking its initial content as argument.

func (*CertSet) Clone

func (cs *CertSet) Clone() *CertSet

Clone creates a copy of the CertSet.

func (*CertSet) Copy

func (cs *CertSet) Copy(dst *CertSet, cond func(*tls.Certificate) bool) *CertSet

Copy copies all certificates that satisfy the condition to the destination CertSet unless they are already there. If a destination isn't provided one will be created. If a condition function isn't provided, all certificates not present in the destination will be added.

type KeySet

KeySet keeps a thread-safe set of unique [x509utils.PrivateKey]s.

func MustKeySet

func MustKeySet(keys ...x509utils.PrivateKey) *KeySet

MustKeySet is like NewKeySet but panics on errors.

func NewKeySet

func NewKeySet(keys ...x509utils.PrivateKey) (*KeySet, error)

NewKeySet creates a KeySet optionally taking its initial content as argument.

func (*KeySet) Clone

func (ks *KeySet) Clone() *KeySet

Clone creates a copy of the KeySet.

func (*KeySet) Copy

func (ks *KeySet) Copy(dst *KeySet, cond func(x509utils.PrivateKey) bool) *KeySet

Copy copies all keys that satisfy the condition to the destination KeySet unless they are already there. If a destination isn't provided one will be created. If a condition function isn't provided, all keys not present in the destination will be added.

func (*KeySet) GetFromCertificate

func (ks *KeySet) GetFromCertificate(cert *x509.Certificate) (x509utils.PrivateKey, error)

GetFromCertificate is like Get but uses the public key associated with the given certificate.

func (*KeySet) Public

Public handles type-casting of public keys.

Jump to

Keyboard shortcuts

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