truststore

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 8

Documentation

Overview

Package truststore reads certificates in a trust store

Index

Constants

This section is empty.

Variables

View Source
var (
	Types = []Type{
		TypeCA,
		TypeSigningAuthority,
	}
)

Functions

func ValidateCertificates

func ValidateCertificates(certs []*x509.Certificate) error

ValidateCertificates ensures certificates from trust store are CA certificates or self-signed.

Types

type CertificateError added in v1.0.1

type CertificateError struct {
	Msg        string
	InnerError error
}

CertificateError is used when reading a certificate failed

func (CertificateError) Error added in v1.0.1

func (e CertificateError) Error() string

func (CertificateError) Unwrap added in v1.0.1

func (e CertificateError) Unwrap() error

type TrustStoreError added in v1.0.1

type TrustStoreError struct {
	Msg        string
	InnerError error
}

TrustStoreError is used when accessing specified trust store failed

func (TrustStoreError) Error added in v1.0.1

func (e TrustStoreError) Error() string

func (TrustStoreError) Unwrap added in v1.0.1

func (e TrustStoreError) Unwrap() error

type Type

type Type string

Type is an enum for trust store types supported such as "ca" and "signingAuthority"

const (
	TypeCA               Type = "ca"
	TypeSigningAuthority Type = "signingAuthority"
)

type X509TrustStore

type X509TrustStore interface {
	// GetCertificates returns certificates under storeType/namedStore
	GetCertificates(ctx context.Context, storeType Type, namedStore string) ([]*x509.Certificate, error)
}

X509TrustStore provide list and get behaviors for the trust store

func NewX509TrustStore

func NewX509TrustStore(trustStorefs dir.SysFS) X509TrustStore

NewX509TrustStore generates a new X509TrustStore

Jump to

Keyboard shortcuts

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