tlsgen

package
v0.0.0-...-fbe82ab Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA interface {
	//certbytes返回采用PEM编码的CA证书
	CertBytes() []byte

	//newcertkeypair返回证书和私钥对以及nil,
	//或零,故障时出错
	//证书由CA签名,用于TLS客户端身份验证
	NewClientCertKeyPair() (*CertKeyPair, error)

	//newservercertkeypair返回certkeypair和nil,
	//具有给定的自定义SAN。
	//证书由CA签名。
	//返回nil,失败时出错
	NewServerCertKeyPair(host string) (*CertKeyPair, error)
}

CA定义可以生成的证书颁发机构 由其签署的证书

func NewCA

func NewCA() (CA, error)

type CertKeyPair

type CertKeyPair struct {
	//cert是证书,pem编码
	Cert []byte
	//密钥是与证书对应的密钥,PEM编码
	Key []byte

	crypto.Signer
	TLSCert *x509.Certificate
}

certkeypair表示一个tls证书和相应的密钥, 两个PEM编码

func CertKeyPairFromString

func CertKeyPairFromString(privKey string, pubKey string) (*CertKeyPair, error)

certkeypairfromstring将base64编码的给定字符串转换为certkeypair

func (*CertKeyPair) PrivKeyString

func (p *CertKeyPair) PrivKeyString() string

func (*CertKeyPair) PubKeyString

func (p *CertKeyPair) PubKeyString() string

Jump to

Keyboard shortcuts

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