cert

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cert HTTPS证书

Package cert 证书管理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRootCAPem added in v1.1.2

func DefaultRootCAPem() []byte

RootCA 根证书

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 added in v1.1.2

func NewCertificate(cache Cache) *Certificate

func (*Certificate) GenerateCA added in v1.1.2

func (c *Certificate) GenerateCA() (*Pair, error)

GenerateCA 生成根证书

func (*Certificate) GeneratePem added in v1.1.2

func (c *Certificate) GeneratePem(host string, expireDays int, rootCA *x509.Certificate, rootKey *rsa.PrivateKey) (*Pair, error)

Generate 生成证书

func (*Certificate) GenerateTlsConfig added in v1.1.2

func (c *Certificate) GenerateTlsConfig(host string) (*tls.Config, error)

GenerateTlsConfig 生成TLS配置

type Pair added in v1.1.2

type Pair struct {
	Cert            *x509.Certificate
	CertBytes       []byte
	PrivateKey      *rsa.PrivateKey
	PrivateKeyBytes []byte
}

Jump to

Keyboard shortcuts

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