x509

package
v2.25.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRevoked = errors.New("certificate revoked")

Functions

func IsRevoked added in v2.25.0

func IsRevoked(certificate *x509.Certificate, crl *x509.RevocationList) bool

func IsRootCA added in v2.13.0

func IsRootCA(cert *x509.Certificate) bool

func ParsePrivateKey added in v2.13.0

func ParsePrivateKey(pemBlock []byte) (*ecdsa.PrivateKey, error)

ParsePrivateKey parses certificates from PEM format

func ParseX509 added in v2.13.0

func ParseX509(pemBlock []byte) ([]*x509.Certificate, error)

ParseX509 parses certificates from PEM format

func ReadPrivateKey added in v2.13.0

func ReadPrivateKey(path string) (*ecdsa.PrivateKey, error)

ReadPrivateKey reads private key from file in PEM format

func ReadX509 added in v2.13.0

func ReadX509(path string) ([]*x509.Certificate, error)

ReadFile reads certificates from file in PEM format

func ValidateCRLDistributionPointAddress added in v2.25.0

func ValidateCRLDistributionPointAddress(s string) error

func Verify added in v2.13.0

func Verify(certificates []*x509.Certificate, certificateAuthorities []*x509.Certificate, useSystemRoots bool, opts x509.VerifyOptions) ([][]*x509.Certificate, error)

Verify verifies certificate against certificate authorities.

func VerifyChain added in v2.25.0

func VerifyChain(chain []*x509.Certificate, capool *x509.CertPool, crlVerify CRLVerification) error

func VerifyChains added in v2.25.0

func VerifyChains(capool *x509.CertPool, crlVerify CRLVerification) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error

Types

type CRLVerification added in v2.25.0

type CRLVerification struct {
	Enabled bool
	Ctx     context.Context
	Verify  VerifyByCRL
}

type CertificateInfo

type CertificateInfo struct {
	SubjectName        string    `json:"subjectName,omitempty"`
	Organization       []string  `json:"organization,omitempty"`
	IssuerName         string    `json:"issuerName,omitempty"`
	IssuerOrganization []string  `json:"issuerOrganization,omitempty"`
	NotAfter           time.Time `json:"notAfter,omitempty"`
	NotBefore          time.Time `json:"notBefore,omitempty"`
	SerialNumber       string    `json:"serialNumber,omitempty"`
}

func ParseCertificate

func ParseCertificate(cert *x509.Certificate) *CertificateInfo

type CustomDistributionPointVerification added in v2.25.0

type CustomDistributionPointVerification = map[string]VerifyDistributionPoint

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(chains [][]*x509.Certificate, err error) *Error

func (*Error) Chains

func (e *Error) Chains() [][]*x509.Certificate

func (*Error) Error

func (e *Error) Error() string

func (*Error) LeafCertificateInfo

func (e *Error) LeafCertificateInfo() *CertificateInfo

type Options added in v2.25.0

type Options struct {
	CustomDistributionPointVerification CustomDistributionPointVerification
}

type SetOption added in v2.25.0

type SetOption = func(cfg *Options)

func WithCustomDistributionPointVerification added in v2.25.0

func WithCustomDistributionPointVerification(customDistributionPointVerification CustomDistributionPointVerification) SetOption

type VerifyByCRL added in v2.25.0

type VerifyByCRL = func(context.Context, *x509.Certificate, []string) error

type VerifyDistributionPoint added in v2.25.0

type VerifyDistributionPoint = func(context.Context, *x509.Certificate, string) error

Jump to

Keyboard shortcuts

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