tlscert

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeSelfSignedHostTLSCertificate

func MakeSelfSignedHostTLSCertificate(dnCountry, dnOrganization, hostDNSName string) (tlsCert *tls.Certificate, err error)

MakeSelfSignedHostTLSCertificate create a copy of self-signed host TLS certificate.

Types

type CertificateKeyPair

type CertificateKeyPair struct {
	CertDERBytes []byte
	Certificate  *x509.Certificate
	PrivateKey   *rsa.PrivateKey
}

func NewCertificateKeyPairFromQBw1HostCertificateAssignment

func NewCertificateKeyPairFromQBw1HostCertificateAssignment(a *qbw1grpcgen.HostCertificateAssignment) (k *CertificateKeyPair, err error)

NewCertificateKeyPairFromQBw1HostCertificateAssignment create certificate key pair from HostCertificateAssignment.

func NewCertificateKeyPairFromQBw1RootCertificateAssignment

func NewCertificateKeyPairFromQBw1RootCertificateAssignment(a *qbw1grpcgen.RootCertificateAssignment) (k *CertificateKeyPair, err error)

NewCertificateKeyPairFromQBw1RootCertificateAssignment create certificate key pair from root certificate assignment.

func (*CertificateKeyPair) MarshalJSON

func (k *CertificateKeyPair) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface,

func (*CertificateKeyPair) QBw1HostCertificateAssignment

func (k *CertificateKeyPair) QBw1HostCertificateAssignment(hostName string) (resp *qbw1grpcgen.HostCertificateAssignment)

func (*CertificateKeyPair) TLSCertificate

func (k *CertificateKeyPair) TLSCertificate(rootKeyPair *CertificateKeyPair) (tlsCert *tls.Certificate)

func (*CertificateKeyPair) UnmarshalJSON

func (k *CertificateKeyPair) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implement json.Unmarshaler interface.

type Provider

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

Provider of TLS certificate service.

func (*Provider) CollectSelfSignedHosts

func (p *Provider) CollectSelfSignedHosts(spanEmitter *qabalwrap.TraceEmitter) (hostNames []string)

CollectSelfSignedHosts get hostnames with self-signed certificate issued.

func (*Provider) HaveRootCertificate

func (lc *Provider) HaveRootCertificate() (rootCertExisted bool)

HaveRootCertificate check if root certificate existed.

func (*Provider) Init

func (p *Provider) Init(
	serviceInstIdent qabalwrap.ServiceInstanceIdentifier,
	dnCountry, dnOrganization string,
	stateStore *qabalwrap.StateStore,
	primaryTLSCertProvider bool) (err error)

func (*Provider) PostSetup

func (p *Provider) PostSetup(waitGroup *sync.WaitGroup, spanEmitter *qabalwrap.TraceEmitter) (err error)

PostSetup should be invoke at maintenance thread in setup stage.

func (*Provider) PrepareQBw1HostCertificateAssignment

func (p *Provider) PrepareQBw1HostCertificateAssignment(spanEmitter *qabalwrap.TraceEmitter, hostName string) (resp *qbw1grpcgen.HostCertificateAssignment, err error)

func (*Provider) RegisterHostTLSCertificates

func (p *Provider) RegisterHostTLSCertificates(
	spanEmitter *qabalwrap.TraceEmitter,
	hostNames []string,
	certSubscriber qabalwrap.CertificateSubscriber) (hostTLSCertWatchTrackIdent int, err error)

RegisterHostTLSCertificates implement CertificateProvider interface. Should only invoke at maintenance thread in setup stage.

func (*Provider) UpdateHostCertificate

func (p *Provider) UpdateHostCertificate(waitGroup *sync.WaitGroup, spanEmitter *qabalwrap.TraceEmitter, hostName string, certKeyPair *CertificateKeyPair) (err error)

UpdateHostCertificate associate given certificate with given host name and invoke TLS certificate update.

func (*Provider) UpdateRootCertificate

func (p *Provider) UpdateRootCertificate(waitGroup *sync.WaitGroup, spanEmitter *qabalwrap.TraceEmitter, certKeyPair *CertificateKeyPair) (err error)

UpdateRootCertificate set given certificate as root certificate and update registered subscribers.

Jump to

Keyboard shortcuts

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