cert

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCACertificate

func GenerateCACertificate(subject pkix.Name, privateKey *rsa.PrivateKey) (template *x509.Certificate, cert tls.Certificate, certPem []byte, keyPem []byte, err error)

func GenerateCertificate

func GenerateCertificate(subject pkix.Name, dnsNames []string, ipAddresses []net.IP, caCertTemplate *x509.Certificate,
	caPrivateKey, privateKey *rsa.PrivateKey) (cert tls.Certificate, err error)

func GenerateCertificateWithPEM

func GenerateCertificateWithPEM(subject pkix.Name, dnsNames []string, ipAddresses []net.IP, caCertTemplate *x509.Certificate,
	caPrivateKey, privateKey *rsa.PrivateKey) (cert tls.Certificate, certPem []byte, keyPem []byte, err error)

func GeneratePrivateKey

func GeneratePrivateKey() (*rsa.PrivateKey, error)

func GetClientMTlsConfig

func GetClientMTlsConfig(certPath, keyPath, caPath, hostname string) (*tls.Config, error)

func GetClientTlsConfig

func GetClientTlsConfig(caPath, hostname string) (*tls.Config, error)

client tls need ca file and Common name

func GetInsecureTlsConfig

func GetInsecureTlsConfig() *tls.Config

func GetServerMTlsConfig

func GetServerMTlsConfig(certPath, keyPath, caPath string) (*tls.Config, error)

func GetServerTlsConfig

func GetServerTlsConfig(certPath, keyPath string) (*tls.Config, error)

server tls need cert file and key file

func LoadCACertificate

func LoadCACertificate(certPath, keyPath string) (caCert *x509.Certificate, caPriKey *rsa.PrivateKey, err error)

Types

type CertPool

type CertPool struct {
	cache.Cache[string, tls.Certificate]
}

func NewCertPool

func NewCertPool(maxCapacity int, checkInterval, certExpiredSecond time.Duration) *CertPool

type PriKeyPool

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

func NewPriKeyPool

func NewPriKeyPool(maxSize int) *PriKeyPool

func (*PriKeyPool) Get

func (p *PriKeyPool) Get() (*rsa.PrivateKey, error)

Jump to

Keyboard shortcuts

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