pki

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Issued    = 0
	NotNeeded = 1
	Error     = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IssueOutcome

type IssueOutcome int

type IssuedCert

type IssuedCert struct {
	PrivateKey  []byte
	Certificate []byte
	CaChain     []byte
}

type KeyPod

type KeyPod interface {
	Read() ([]byte, error)
	CanRead() error
	Write(string) error
	CanWrite() error
}

KeyPod is a simple wrapper around a key (which is just a byte stream itself). This way, we decouple the implementation (file-based, memory, network, ..) and make it easily swap- and testable.

type Pki

type Pki interface {
	// Issue issues a new certificate from the PKI
	Issue(opts conf.IssueArguments) (*IssuedCert, error)

	// Sign signs a CSR
	Sign(csr KeyPod, opts conf.SignArguments) (*Signature, error)

	// Revoke revokes a certificate by its serial number
	Revoke(serial string) error

	// Tidy cleans up the PKI cert storage of dangling certificates
	Tidy() error

	// Cleanup cleans up the used resources of the client is not related to PKI operations
	Cleanup() error
}

type PkiCli

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

func NewPki

func NewPki(pki Pki, strategy issue_strategies.IssueStrategy) (*PkiCli, error)

func (*PkiCli) Issue

func (p *PkiCli) Issue(certFile, privateKeyFile KeyPod, opts conf.IssueArguments) (IssueOutcome, error)

func (*PkiCli) Revoke

func (p *PkiCli) Revoke(serial string) error

func (*PkiCli) Sign added in v1.4.0

func (p *PkiCli) Sign(certFile, csrFile KeyPod, opts conf.SignArguments) error

func (*PkiCli) Tidy

func (p *PkiCli) Tidy() error

type Signature added in v1.4.0

type Signature struct {
	Certificate []byte
	CaChain     []byte
	Serial      string
}

Jump to

Keyboard shortcuts

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