certs

package
v1.7.0-rc13 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MPL-2.0 Imports: 21 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CertManagerLogPrefix = "cert_storage"

Functions

func GenCertificate

func GenCertificate(template *x509.Certificate, setLeaf bool) ([]byte, []byte, []byte, tls.Certificate)

func GenServerCertificate

func GenServerCertificate() ([]byte, []byte, []byte, tls.Certificate)

func GetCertIDAndChainPEM

func GetCertIDAndChainPEM(certData []byte, secret string) (string, []byte, error)

func HexSHA256

func HexSHA256(cert []byte) string

func ParsePEM

func ParsePEM(data []byte, secret string) ([]*pem.Block, error)

func ParsePEMCertificate

func ParsePEMCertificate(data []byte, secret string) (*tls.Certificate, error)

Types

type CertificateBasics

type CertificateBasics struct {
	ID            string    `json:"id"`
	IssuerCN      string    `json:"issuer_cn"`
	SubjectCN     string    `json:"subject_cn"`
	DNSNames      []string  `json:"dns_names"`
	HasPrivateKey bool      `json:"has_private"`
	NotBefore     time.Time `json:"not_before"`
	NotAfter      time.Time `json:"not_after"`
}

func ExtractCertificateBasics

func ExtractCertificateBasics(cert *tls.Certificate, certID string) *CertificateBasics

type CertificateManager

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

func NewCertificateManager

func NewCertificateManager(storage storage.Handler, secret string, logger *logrus.Logger, migrateCertList bool) *CertificateManager

func NewSlaveCertManager

func NewSlaveCertManager(localStorage, rpcStorage storage.Handler, secret string, logger *logrus.Logger, migrateCertList bool) *CertificateManager

func (*CertificateManager) Add

func (c *CertificateManager) Add(certData []byte, orgID string) (string, error)

func (*CertificateManager) CertPool

func (c *CertificateManager) CertPool(certIDs []string) *x509.CertPool

func (*CertificateManager) Delete

func (c *CertificateManager) Delete(certID string, orgID string)

func (*CertificateManager) FlushCache

func (c *CertificateManager) FlushCache()

func (*CertificateManager) GetRaw

func (c *CertificateManager) GetRaw(certID string) (string, error)

func (*CertificateManager) List

func (c *CertificateManager) List(certIDs []string, mode CertificateType) (out []*tls.Certificate)

func (*CertificateManager) ListAllIds

func (c *CertificateManager) ListAllIds(prefix string) (out []string)

func (*CertificateManager) ListPublicKeys

func (c *CertificateManager) ListPublicKeys(keyIDs []string) (out []string)

Returns list of fingerprints

func (*CertificateManager) ListRawPublicKey

func (c *CertificateManager) ListRawPublicKey(keyID string) (out interface{})

Returns list of fingerprints

func (*CertificateManager) ValidateRequestCertificate

func (c *CertificateManager) ValidateRequestCertificate(certIDs []string, r *http.Request) error

type CertificateMeta

type CertificateMeta struct {
	ID            string    `json:"id"`
	Fingerprint   string    `json:"fingerprint"`
	HasPrivateKey bool      `json:"has_private"`
	Issuer        pkix.Name `json:"issuer,omitempty"`
	Subject       pkix.Name `json:"subject,omitempty"`
	NotBefore     time.Time `json:"not_before,omitempty"`
	NotAfter      time.Time `json:"not_after,omitempty"`
	DNSNames      []string  `json:"dns_names,omitempty"`
}

func ExtractCertificateMeta

func ExtractCertificateMeta(cert *tls.Certificate, certID string) *CertificateMeta

type CertificateType

type CertificateType int
const (
	CertificatePrivate CertificateType = iota
	CertificatePublic
	CertificateAny
)

Jump to

Keyboard shortcuts

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