cert

package
v0.0.0-...-e9f0680 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cert HTTPS证书

Package cert 证书管理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRootCAPem

func DefaultRootCAPem() []byte

DefaultRootCAPem 根证书

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, useDefaultPrivateKey ...bool) *Certificate

func (*Certificate) GenerateCA

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

GenerateCA 生成根证书

func (*Certificate) GeneratePem

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

GeneratePem 生成证书

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      *ecdsa.PrivateKey
	PrivateKeyBytes []byte
}

Jump to

Keyboard shortcuts

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