cert

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertificateType

func CertificateType(cert *x509.Certificate) string

func DecodeCertificatesPEM

func DecodeCertificatesPEM(data []byte) ([]*x509.Certificate, error)

func ExtKeyUsageToString

func ExtKeyUsageToString(extKeyUsage []x509.ExtKeyUsage) []string

ExtKeyUsageToString converts extended key usage integer values to strings

func IsRoot

func IsRoot(cert *x509.Certificate) bool

func KeyUsageToString

func KeyUsageToString(keyUsage x509.KeyUsage) []string

KeyUsageToString converts key usage bit values to strings

func ValidityFormat

func ValidityFormat(t time.Time) string

Types

type Certificate

type Certificate struct {
	// position of certificate in the chain, starts with 0
	Index           int
	X509Certificate *x509.Certificate
}

func (Certificate) IsExpired

func (c Certificate) IsExpired() bool

func (Certificate) IsExpiredAt

func (c Certificate) IsExpiredAt(t time.Time) bool

func (Certificate) String

func (c Certificate) String() string

func (Certificate) ToPEM

func (c Certificate) ToPEM() []byte

type CertificateLocation

type CertificateLocation struct {
	TLSVersion     uint16 // only applicable for network certificates
	Path           string
	Certificates   Certificates
	VerifiedChains []Certificates // only applicable for network certificates
}

func LoadCertificate

func LoadCertificate(fileName string, data []byte) (CertificateLocation, error)

func LoadCertificateFromStdin

func LoadCertificateFromStdin() (CertificateLocation, error)

func LoadCertificatesFromFile

func LoadCertificatesFromFile(fileName string) (CertificateLocation, error)

func LoadCertificatesFromNetwork

func LoadCertificatesFromNetwork(addr string, tlsSkipVerify bool) (CertificateLocation, error)

type Certificates

type Certificates []Certificate

func FromBytes

func FromBytes(data []byte) (Certificates, error)

FromBytes converts raw certificate bytes to certificate, if the supplied data is cert bundle (or chain) all the certificates will be returned

func FromX509Certificates

func FromX509Certificates(cs []*x509.Certificate) Certificates

Jump to

Keyboard shortcuts

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