ca

package
v0.0.0-...-e3e94bd Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadECDSACertificate

func LoadECDSACertificate(path string) (cert *x509.Certificate, err error)

Types

type CA

type CA struct {
	Name               string // 存储该证书的文件名:[name]-cert.pem
	Country            string
	Province           string
	Locality           string
	OrganizationalUnit string
	StreetAddress      string
	PostalCode         string
	Signer             crypto.Signer // SignCert 与 Signer 是一对公私钥
	SignCert           *x509.Certificate
}

func NewCA

func NewCA(baseDir, org, name, country, province, locality, orgUnit, streetAddress, postalCode string) (*CA, error)

NewCA 传递的第三个参数 name 用来定义存储证书的文件名。

func (*CA) SignCertificate

func (ca *CA) SignCertificate(baseDir, name string, orgUnits, alternateNames []string, publicKey *ecdsa.PublicKey, ku x509.KeyUsage, eku []x509.ExtKeyUsage) (*x509.Certificate, error)

SignCertificate 给定一个公钥,利用 CA 的私钥对其进行签名,签署得到一个 x509 证书。

Jump to

Keyboard shortcuts

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