cert

package
v0.0.0-...-97dd610 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNITag int = 6
)

Variables

This section is empty.

Functions

func AppendEndpoint

func AppendEndpoint(endpoint *rule.Endpoint, cert *x509.Certificate)

func DecodeCert

func DecodeCert(cert string) *x509.Certificate

func DecodePrivateKey

func DecodePrivateKey(cert string) *ecdsa.PrivateKey

func EncodePrivateKey

func EncodePrivateKey(caPrivKey *ecdsa.PrivateKey) string

func EncodePublicKey

func EncodePublicKey(pub *ecdsa.PublicKey) (res string)

func GenerateCSR

func GenerateCSR() (string, *ecdsa.PrivateKey, error)

func LoadCSR

func LoadCSR(csrString string) (*x509.CertificateRequest, error)

func NewStorage

func NewStorage(options *config.Options) *storageImpl

func SignFromCSR

func SignFromCSR(csr *x509.CertificateRequest, endpoint *rule.Endpoint, authorityCert *Cert, certValidity int64) (string, error)

Types

type Cert

type Cert struct {
	Cert       *x509.Certificate
	CertPem    string
	PrivateKey *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

func GenerateAuthorityCert

func GenerateAuthorityCert(rootCert *Cert, caValidity int64) *Cert

func SignServerCert

func SignServerCert(authorityCert *Cert, serverName []string, certValidity int64) *Cert

func (*Cert) GetTlsCert

func (c *Cert) GetTlsCert() *tls.Certificate

func (*Cert) IsValid

func (c *Cert) IsValid() bool

func (*Cert) NeedRefresh

func (c *Cert) NeedRefresh() bool

type Storage

type Storage interface {
	GetServerCert(serverName string) *tls.Certificate
	RefreshServerCert()

	SetAuthorityCert(*Cert)
	GetAuthorityCert() *Cert

	SetRootCert(*Cert)
	GetRootCert() *Cert

	AddTrustedCert(*Cert)
	GetTrustedCerts() []*Cert

	GetStopChan() chan os.Signal
}

Jump to

Keyboard shortcuts

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