keys

package
v4.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Overview

Package keys implements tools to manage HTTPS certificates and session keys for Mr. Plotter. The certificates are stored in etcd, so a Version 3 etcd client is needed for most of the API functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAutocertCache

func DeleteAutocertCache(ctx context.Context, etcdClient *etcd.Client, key string) error

func DropAutocertCache

func DropAutocertCache(ctx context.Context, etcdClient *etcd.Client) error

func GetAutocertCache

func GetAutocertCache(ctx context.Context, etcdClient *etcd.Client, key string) (string, error)

func GetAutocertEmail

func GetAutocertEmail(ctx context.Context, etcdClient *etcd.Client) (string, error)

func GetAutocertHostname

func GetAutocertHostname(ctx context.Context, etcdClient *etcd.Client) (string, error)

func GetCertificateSource

func GetCertificateSource(ctx context.Context, etcdClient *etcd.Client) (string, error)

func GetHttpsCertEtcdPath

func GetHttpsCertEtcdPath() string

Gets the base path for https certificates in etcd.

func PutAutocertCache

func PutAutocertCache(ctx context.Context, etcdClient *etcd.Client, key string, val string) error

func SelfSignedCertificate

func SelfSignedCertificate(dnsNames []string) (*pem.Block, *pem.Block, error)

SelfSignedCertificate generates a self-signed certificate. Much of this is from https://golang.org/src/crypto/tls/generate_cert.go. All credit to the Go Authors.

func SerializeCertificate

func SerializeCertificate(certificate *tls.Certificate) (*pem.Block, *pem.Block, error)

SerializeCertificate serializes a TLS certificate into the cert and key PEM files.

func SetAutocertEmail

func SetAutocertEmail(ctx context.Context, etcdClient *etcd.Client, email string) error

func SetAutocertHostname

func SetAutocertHostname(ctx context.Context, etcdClient *etcd.Client, hostname string) error

func SetCertificateSource

func SetCertificateSource(ctx context.Context, etcdClient *etcd.Client, source string) error

func SetEtcdKeyPrefix

func SetEtcdKeyPrefix(prefix string)

func UpsertHardcodedTLSCertificate

func UpsertHardcodedTLSCertificate(ctx context.Context, etcdClient *etcd.Client, hardcoded *HardcodedTLSCertificate) error

func UpsertHardcodedTLSCertificateAtomically

func UpsertHardcodedTLSCertificateAtomically(ctx context.Context, etcdClient *etcd.Client, hardcoded *HardcodedTLSCertificate) (bool, error)

func UpsertSessionKeys

func UpsertSessionKeys(ctx context.Context, etcdClient *etcd.Client, sk *SessionKeys) error

func UpsertSessionKeysAtomically

func UpsertSessionKeysAtomically(ctx context.Context, etcdClient *etcd.Client, sk *SessionKeys) (bool, error)

Types

type EtcdCache

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

func NewEtcdCache

func NewEtcdCache(etcdClient *etcd.Client) *EtcdCache

func (*EtcdCache) Delete

func (ec *EtcdCache) Delete(ctx context.Context, key string) error

func (*EtcdCache) Get

func (ec *EtcdCache) Get(ctx context.Context, key string) ([]byte, error)

func (*EtcdCache) Put

func (ec *EtcdCache) Put(ctx context.Context, key string, val []byte) error

type HardcodedTLSCertificate

type HardcodedTLSCertificate struct {
	Cert []byte
	Key  []byte
	// contains filtered or unexported fields
}

func RetrieveHardcodedTLSCertificate

func RetrieveHardcodedTLSCertificate(ctx context.Context, etcdClient *etcd.Client) (h *HardcodedTLSCertificate, err error)

func (*HardcodedTLSCertificate) GetRetrievedRevision

func (h *HardcodedTLSCertificate) GetRetrievedRevision() int64

func (*HardcodedTLSCertificate) SetRetrievedRevision

func (h *HardcodedTLSCertificate) SetRetrievedRevision(rev int64)

type SessionKeys

type SessionKeys struct {
	EncryptKey []byte
	MACKey     []byte
	// contains filtered or unexported fields
}

func RetrieveSessionKeys

func RetrieveSessionKeys(ctx context.Context, etcdClient *etcd.Client) (sk *SessionKeys, err error)

func (*SessionKeys) GetRetrievedRevision

func (sk *SessionKeys) GetRetrievedRevision() int64

func (*SessionKeys) SetRetrievedRevision

func (sk *SessionKeys) SetRetrievedRevision(rev int64)

Jump to

Keyboard shortcuts

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