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 证书。
Click to show internal directories.
Click to hide internal directories.