Documentation
¶
Index ¶
- Constants
- func DistinguishedName(dn pkix.Name, dnType DNType) string
- func Encode2DigitHex(bytes []byte) string
- func ParseCertificateFile(certFile string) (cert *x509.Certificate, err error)
- func ParseCertificateFiles(certFiles ...string) (certs []*x509.Certificate, err error)
- func VerifyValidity(cert *x509.Certificate, days int) (message string, err error)
- type DNType
- type PrivateKeyInfo
- type PublicKeyInfo
Constants ¶
const ( // strict format (RFC 4514) StrictDN = DNType(iota) // loose format with space LooseDN // OpenSSL format OpenSSLDN )
DNType name
Variables ¶
This section is empty.
Functions ¶
func DistinguishedName ¶
DistinguishedName converts Distinguished Name to the specified type.
func Encode2DigitHex ¶
Encode2DigitHex encodes bytes into two-digit hexadecimal strings separated by a colon.
func ParseCertificateFile ¶
func ParseCertificateFile(certFile string) (cert *x509.Certificate, err error)
ParseCertificateFile parses a certifcate file in PEM format and returns the first certificate.
func ParseCertificateFiles ¶
func ParseCertificateFiles(certFiles ...string) (certs []*x509.Certificate, err error)
ParseCertificateFiles parses certifcate files in PEM format and returns certificates.
func VerifyValidity ¶
func VerifyValidity(cert *x509.Certificate, days int) (message string, err error)
VerifyValidity verifies the validity of the certificate.
Types ¶
type PrivateKeyInfo ¶
type PrivateKeyInfo struct {
PublicKeyAlgorithm x509.PublicKeyAlgorithm
Key interface{}
}
PrivateKeyInfo describes the information of a private key.
func ParsePrivateKeyFile ¶
func ParsePrivateKeyFile(keyFile string, password []byte) (privateKeyInfo PrivateKeyInfo, err error)
ParsePrivateKeyFile parses a private key file in PEM format and returns a private key.
type PublicKeyInfo ¶
type PublicKeyInfo struct {
SourceName string
TypeLabel string
PublicKeyAlgorithm x509.PublicKeyAlgorithm
Key interface{}
KeyString string
Option map[string]string
}
PublicKeyInfo describes the information of a public key.
func ExtractPublicKeyFromCertificate ¶
func ExtractPublicKeyFromCertificate(cert *x509.Certificate) (publicKeyInfo PublicKeyInfo, err error)
ExtractPublicKeyFromCertificate extracts a public key from a certificate.
func ExtractPublicKeyFromPrivateKey ¶
func ExtractPublicKeyFromPrivateKey(privateKeyInfo PrivateKeyInfo) (publicKeyInfo PublicKeyInfo, err error)
ExtractPublicKeyFromPrivateKey extracts a public key from a private key.