cert

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IssuersTemplate = []pkix.Name{
	{
		Country:      []string{"BE"},
		Organization: []string{"GlobalSign nv-sa"},
		CommonName:   "GlobalSign ECC OV SSL CA 2018",
	},
}
View Source
var SubjectTemplate = []pkix.Name{
	{
		Country:      []string{"CN"},
		Province:     []string{"上海"},
		Locality:     []string{"上海"},
		Organization: []string{"上海幻电信息科技有限公司"},
		CommonName:   "*.mcdn.bilivideo.cn",
	},
}

Functions

This section is empty.

Types

type Algorithm

type Algorithm struct {
	SignatureAlgorithm x509.SignatureAlgorithm
	PublicKeyAlgorithm x509.PublicKeyAlgorithm
	GenerateKey        func() (crypto.Signer, error)
}

func GetAlgorithmsByPublicKeyAlgorithm

func GetAlgorithmsByPublicKeyAlgorithm(algo x509.PublicKeyAlgorithm) Algorithm

type Ca

type Ca struct {
	Cert       *x509.Certificate
	PrivateKey crypto.Signer
}

func GenerateCa

func GenerateCa() (*Ca, error)

func ParseCa

func ParseCa(certBytes, privateKeyBytes []byte) (*Ca, error)

func (*Ca) CertBytes

func (c *Ca) CertBytes() ([]byte, error)

CertBytes pem

func (*Ca) GenerateServerCert

func (c *Ca) GenerateServerCert(hosts ...string) (*ServerCert, error)

func (*Ca) PrivateKeyBytes

func (c *Ca) PrivateKeyBytes() ([]byte, error)

PrivateKeyBytes pem

func (*Ca) PublicKeyBytes

func (c *Ca) PublicKeyBytes() ([]byte, error)

PublicKeyBytes pem

type ServerCert

type ServerCert struct {
	Ca         *Ca
	Cert       *x509.Certificate
	PrivateKey crypto.Signer
}

func (*ServerCert) PrivateKeyBytes

func (c *ServerCert) PrivateKeyBytes() ([]byte, error)

func (*ServerCert) TlsCert

func (s *ServerCert) TlsCert() (tls.Certificate, error)

Jump to

Keyboard shortcuts

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