krl

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 14 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

Index

Constants

View Source
const (
	// FileMode is the mode of an installed KRL, which is read-only as
	// nothing but [Verified.Install] should change it
	FileMode fs.FileMode = 0440
)
View Source
const Namespace = "krl@com.github.serverless-ssh-ca.andrewheberle"

Namespace is the SSHSIG namespace the CA signs KRLs with

Variables

View Source
var (
	// ErrInvalidSignature is returned when the signature on the KRL cannot be
	// decoded or does not verify with the CA public key
	ErrInvalidSignature = errors.New("krl signature verification failed")

	// ErrNoPublicKey is returned when no CA public key is provided to verify
	// the signature on the KRL with
	ErrNoPublicKey = errors.New("no public key provided for signature verification")

	// ErrOlderKRL is returned when the KRL is older than an existing KRL
	ErrOlderKRL = errors.New("krl is older than the existing krl")

	// ErrUnexpectedCA is returned when a certificate section of the KRL is not
	// for the CA, including sections that apply to any CA
	ErrUnexpectedCA = errors.New("encountered krl certificate section with unexpected CA")

	// ErrUnexpectedSection is returned when the KRL contains a section that
	// does not revoke certificates, such as one revoking explicit keys
	ErrUnexpectedSection = errors.New("encountered unexpected section type in krl")
)

Functions

This section is empty.

Types

type CertificateType added in v0.23.1

type CertificateType string

CertificateType is the type of certificate a KRL revokes

const (
	// User is the KRL for user certificates
	User CertificateType = "user"

	// Host is the KRL for host certificates
	Host CertificateType = "host"
)

type Outcome added in v0.25.1

type Outcome int

Outcome is the result of a successful Verified.Install

const (
	// Written means the KRL was written, replacing any older KRL
	Written Outcome = iota

	// Unchanged means the file already held the KRL with [FileMode], so it
	// was not written
	Unchanged

	// ReplacedUnparseable means the file held something that could not be
	// parsed as a KRL, so it was replaced
	ReplacedUnparseable
)

func (Outcome) String added in v0.25.1

func (o Outcome) String() string

type Verified added in v0.25.1

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

Verified is a KRL whose signature has been verified with the CA public key and that only revokes certificates issued by that CA. It can only be obtained from Fetch.

func Fetch added in v0.25.1

func Fetch(ctx context.Context, server string, certificatetype CertificateType, pub ssh.PublicKey, opts ...api.ClientOption) (*Verified, error)

Fetch retrieves the KRL for certificatetype from server and verifies it with pub, which must be the public key of the CA. Requests use the client from httpclient.New unless opts sets another with api.WithHTTPClient.

func (*Verified) Bytes added in v0.25.1

func (v *Verified) Bytes() []byte

Bytes returns the KRL in the format used by OpenSSH

func (*Verified) Generated added in v0.25.1

func (v *Verified) Generated() time.Time

Generated returns the time the KRL was generated by the CA

func (*Verified) Install added in v0.25.1

func (v *Verified) Install(path string) (Outcome, error)

Install atomically writes the KRL to path with FileMode. A KRL older than one already at path is never installed, so a previously issued KRL cannot un-revoke certificates; an error wrapping ErrOlderKRL is returned and the file is left alone. KRLs are compared by version and then by the date they were generated, as the CA does not increase the version for each KRL.

func (*Verified) Sections added in v0.25.1

func (v *Verified) Sections() int

Sections returns the number of sections in the KRL

func (*Verified) Version added in v0.25.1

func (v *Verified) Version() uint64

Version returns the version of the KRL

Jump to

Keyboard shortcuts

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