Documentation
¶
Overview ¶
Package x509 implements a subset of the X.509 standard.
It allows parsing and generating certificates, certificate signing requests, certificate revocation lists, and encoded public and private keys. It provides a certificate verifier, complete with a chain builder.
The package targets the X.509 technical profile defined by the IETF (RFC 2459/3280/5280), and as further restricted by the CA/Browser Forum Baseline Requirements. There is minimal support for features outside of these profiles, as the primary goal of the package is to provide compatibility with the publicly trusted TLS certificate ecosystem and its policies and constraints.
On macOS and Windows, certificate verification is handled by system APIs, but the package aims to apply consistent validation rules across operating systems.
Index ¶
- Variables
- func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv any) ([]byte, error)
- func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv any) (csr []byte, err error)
- func CreateRevocationList(rand io.Reader, template *RevocationList, issuer *Certificate, ...) ([]byte, error)
- func DecryptPEMBlock(b *pem.Block, password []byte) ([]byte, error)deprecated
- func EncryptPEMBlock(rand io.Reader, blockType string, data, password []byte, alg PEMCipher) (*pem.Block, error)deprecated
- func IsEncryptedPEMBlock(b *pem.Block) booldeprecated
- func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error)
- func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte
- func MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte
- func MarshalPKCS8PrivateKey(key any) ([]byte, error)
- func MarshalPKIXPublicKey(pub any) ([]byte, error)
- func ParseCRL(crlBytes []byte) (*pkix.CertificateList, error)deprecated
- func ParseDERCRL(derBytes []byte) (*pkix.CertificateList, error)deprecated
- func ParseECPrivateKey(der []byte) (*ecdsa.PrivateKey, error)
- func ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error)
- func ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error)
- func ParsePKCS8PrivateKey(der []byte) (key any, err error)
- func ParsePKIXPublicKey(derBytes []byte) (pub any, err error)
- func SetFallbackRoots(roots *CertPool)
- type CertPool
- func (s *CertPool) AddCert(cert *Certificate)
- func (s *CertPool) AddCertWithConstraint(cert *Certificate, constraint func([]*Certificate) error)
- func (s *CertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool)
- func (s *CertPool) Clone() *CertPool
- func (s *CertPool) Equal(other *CertPool) bool
- func (s *CertPool) Subjects() [][]bytedeprecated
- type Certificate