Documentation
¶
Overview ¶
Package cert 证书管理
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache interface {
Set(host string, c *tls.Certificate)
Get(host string) *tls.Certificate
}
Cache 证书缓存接口
type Certificate ¶
type Certificate struct {
// contains filtered or unexported fields
}
Certificate 证书管理
func NewCertificate ¶
func NewCertificate(cache Cache) *Certificate
func (*Certificate) GeneratePem ¶
func (c *Certificate) GeneratePem(host string, expireDays int, rootCA *x509.Certificate, rootKey *rsa.PrivateKey) (*Pair, error)
Generate 生成证书
func (*Certificate) GenerateTlsConfig ¶
func (c *Certificate) GenerateTlsConfig(host string) (*tls.Config, error)
GenerateTlsConfig 生成TLS配置
type Pair ¶
type Pair struct {
Cert *x509.Certificate
CertBytes []byte
PrivateKey *rsa.PrivateKey
PrivateKeyBytes []byte
}
Click to show internal directories.
Click to hide internal directories.