internal

package
v0.0.0-...-085f530 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

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

Certificate defines a X.509 certificate and its chain.

func GetCertificate

func GetCertificate(u *url.URL) (*Certificate, error)

GetCertificate returns a certificate from a given URL. Certificate can be sourced from a file (e.g. `file:///path/to/the/cert.pem`), a TCP/UDP connection (e.g. `tcp://1.2.3.4:443`, `https://google.com`) or downloaded (e.g. `https://letsencrypt.org/certs/isrgrootx1.pem`). If no scheme is provided, it defaults to TCP.

func NewCertificate

func NewCertificate(cert *x509.Certificate) *Certificate

NewCertificate creates a new certificate.

func ParseCertificate

func ParseCertificate(data []byte, format string) (*Certificate, error)

func (*Certificate) AddCertificateToChain

func (c *Certificate) AddCertificateToChain(cert *Certificate)

AddCertificateToChain add another certificate to the chain.

func (*Certificate) Chain

func (c *Certificate) Chain() map[string]*Certificate

Chain returns chain of the certificate.

func (*Certificate) CommonName

func (c *Certificate) CommonName() string

CommonName returns common name of the certificate.

func (*Certificate) DNSNames

func (c *Certificate) DNSNames() []string

DNSNames returns DNS names of the certificate.

func (*Certificate) DownloadIssuingCertificate

func (c *Certificate) DownloadIssuingCertificate()

DownloadIssuingCertificate downloads certificate specified in Authority Information Access.

func (*Certificate) Equal

func (c *Certificate) Equal(other *Certificate) bool

Equal reports whether the certificates are the same.

func (*Certificate) IPAddresses

func (c *Certificate) IPAddresses() []net.IP

IPAddresses returns IP addresses of the certificate.

func (*Certificate) IsOCSPPresent

func (c *Certificate) IsOCSPPresent() bool

IsOCSPPresent checks whether the OCSP server URL is present in the certificate.

func (*Certificate) IsValid

func (c *Certificate) IsValid() bool

IsValid checks certificate validity.

func (*Certificate) Issuer

func (c *Certificate) Issuer() pkix.Name

Issuer returns issuer of the certificate.

func (*Certificate) NotAfter

func (c *Certificate) NotAfter() time.Time

NotAfter returns higher expiration bound of the certificate.

func (*Certificate) NotBefore

func (c *Certificate) NotBefore() time.Time

NotBefore returns lower expiration bound of the certificate.

func (*Certificate) OCSPStatus

func (c *Certificate) OCSPStatus() (bool, error)

OCSPStatus checks validity of the certificate with OCSP server.

func (*Certificate) Print

func (c *Certificate) Print(opts *PrintOptions)

Print prints details about certificate.

func (*Certificate) SerialNumber

func (c *Certificate) SerialNumber() *big.Int

SerialNumber returns the certificate's serial number.

func (*Certificate) SignedCertificateTimestamps

func (c *Certificate) SignedCertificateTimestamps() []ct.SignedCertificateTimestamp

SignedCertificateTimestamps returns SCTs of the certificate.

func (*Certificate) Subject

func (c *Certificate) Subject() pkix.Name

Subject returns subject of the certificate.

type PrintOptions

type PrintOptions struct {
	SCTs bool
}

PrintOptions defines cetificate printing options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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