cert

package
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCertificatePolicies added in v1.0.25

func ToCertificatePolicies(in []byte) ([]string, error)

ToCertificatePolicies returns slice of "identifier: qualifier" values

func ToExtendedKeyUsage added in v1.0.25

func ToExtendedKeyUsage(in []byte) ([]string, error)

func ToGeneralNames added in v1.0.25

func ToGeneralNames(in []byte) ([]string, error)

ToGeneralNames returns slice of "type: value1, value2, valueX" strings

func ToKeyUsage added in v1.0.25

func ToKeyUsage(in []byte) ([]string, error)
KeyUsage ::= BIT STRING {
   digitalSignature        (0),
   nonRepudiation          (1),  -- recent editions of X.509 have
                              -- renamed this bit to contentCommitment
   keyEncipherment         (2),
   dataEncipherment        (3),
   keyAgreement            (4),
   keyCertSign             (5),
   cRLSign                 (6),
   encipherOnly            (7),
   decipherOnly            (8) }

func ToRelativeDistinguishedName added in v1.0.25

func ToRelativeDistinguishedName(in []byte) ([]string, error)

ToRelativeDistinguishedName returns slice of "type: value" strings

func ToSignedCertificateTimestampList added in v1.0.26

func ToSignedCertificateTimestampList(in []byte) ([]byte, error)

Types

type AccessDescription added in v1.0.26

type AccessDescription struct {
	AccessMethod   string
	AccessLocation string
}

func ToAuthorityInformationAccess added in v1.0.26

func ToAuthorityInformationAccess(in []byte) ([]AccessDescription, error)

type AuthorityKeyIdentifier added in v1.0.25

type AuthorityKeyIdentifier struct {
	KeyIdentifier             []byte
	AuthorityCertIssuer       []string
	AuthorityCertSerialNumber int
}

AuthorityKeyIdentifier ::= SEQUENCE { keyIdentifier [0] KeyIdentifier OPTIONAL, authorityCertIssuer [1] GeneralNames OPTIONAL, authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } -- authorityCertIssuer and authorityCertSerialNumber MUST both -- be present or both be absent

func ToAuthorityKeyIdentifier added in v1.0.25

func ToAuthorityKeyIdentifier(in []byte) (AuthorityKeyIdentifier, error)

type BasicConstraints added in v1.0.25

type BasicConstraints struct {
	CA                bool `asn1:"optional"`
	PathLenConstraint int  `asn1:"optional"`
}

BasicConstraints ::= SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER (0..MAX) OPTIONAL }

func ToBasicConstraints added in v1.0.25

func ToBasicConstraints(in []byte) (BasicConstraints, error)

type Certificate

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

func (Certificate) AuthorityKeyId added in v1.0.29

func (c Certificate) AuthorityKeyId() string

func (Certificate) DNSNames added in v1.0.29

func (c Certificate) DNSNames() []string

func (Certificate) Error added in v1.0.9

func (c Certificate) Error() error

func (Certificate) ExtKeyUsage added in v1.0.29

func (c Certificate) ExtKeyUsage() []string

ExtKeyUsage extended key usage string representation

func (Certificate) Extensions added in v1.0.25

func (c Certificate) Extensions() []Extension

func (Certificate) IPAddresses added in v1.0.29

func (c Certificate) IPAddresses() []string

func (Certificate) IsCA added in v1.0.29

func (c Certificate) IsCA() bool

func (Certificate) IsExpired

func (c Certificate) IsExpired() bool

func (Certificate) Issuer added in v1.0.29

func (c Certificate) Issuer() string

func (Certificate) KeyUsage added in v1.0.29

func (c Certificate) KeyUsage() []string

func (Certificate) NotAfter added in v1.0.29

func (c Certificate) NotAfter() time.Time

func (Certificate) NotBefore added in v1.0.29

func (c Certificate) NotBefore() time.Time

func (Certificate) SerialNumber added in v1.0.29

func (c Certificate) SerialNumber() string

func (Certificate) SignatureAlgorithm added in v1.0.29

func (c Certificate) SignatureAlgorithm() string

func (Certificate) SubjectKeyId added in v1.0.29

func (c Certificate) SubjectKeyId() string

func (Certificate) SubjectString added in v1.0.10

func (c Certificate) SubjectString() string

func (Certificate) ToPEM

func (c Certificate) ToPEM() []byte

func (Certificate) Type added in v1.0.28

func (c Certificate) Type() string

func (Certificate) Version added in v1.0.29

func (c Certificate) Version() int

type CertificateLocation

type CertificateLocation struct {
	TLSVersion   uint16 // only applicable for network certificates
	Path         string
	Error        error
	Certificates Certificates
}

func LoadCertificateFromClipboard added in v1.0.19

func LoadCertificateFromClipboard() CertificateLocation

func LoadCertificateFromStdin

func LoadCertificateFromStdin() CertificateLocation

func LoadCertificatesFromFile

func LoadCertificatesFromFile(fileName string) CertificateLocation

func LoadCertificatesFromNetwork

func LoadCertificatesFromNetwork(addr string, tlsSkipVerify bool) CertificateLocation

func (CertificateLocation) Chains added in v1.0.28

func (c CertificateLocation) Chains() ([]Certificates, error)

func (CertificateLocation) IssuerLike added in v1.0.24

func (c CertificateLocation) IssuerLike(issuer string) CertificateLocation

func (CertificateLocation) Name added in v1.0.10

func (c CertificateLocation) Name() string

func (CertificateLocation) RemoveDuplicates added in v1.0.13

func (c CertificateLocation) RemoveDuplicates() CertificateLocation

func (CertificateLocation) RemoveExpired added in v1.0.9

func (c CertificateLocation) RemoveExpired() CertificateLocation

func (CertificateLocation) SortByExpiry added in v1.0.23

func (c CertificateLocation) SortByExpiry() CertificateLocation

func (CertificateLocation) SubjectLike added in v1.0.24

func (c CertificateLocation) SubjectLike(subject string) CertificateLocation

type CertificateLocations added in v1.0.9

type CertificateLocations []CertificateLocation

func (CertificateLocations) IssuerLike added in v1.0.24

func (c CertificateLocations) IssuerLike(issuer string) CertificateLocations

func (CertificateLocations) RemoveDuplicates added in v1.0.13

func (c CertificateLocations) RemoveDuplicates() CertificateLocations

func (CertificateLocations) RemoveExpired added in v1.0.9

func (c CertificateLocations) RemoveExpired() CertificateLocations

func (CertificateLocations) SortByExpiry added in v1.0.23

func (c CertificateLocations) SortByExpiry() CertificateLocations

func (CertificateLocations) SubjectLike added in v1.0.24

func (c CertificateLocations) SubjectLike(subject string) CertificateLocations

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

func (Certificates) IssuerLike added in v1.0.24

func (c Certificates) IssuerLike(issuer string) Certificates

func (Certificates) RemoveDuplicates added in v1.0.13

func (c Certificates) RemoveDuplicates() Certificates

func (Certificates) RemoveExpired added in v1.0.9

func (c Certificates) RemoveExpired() Certificates

func (Certificates) SortByExpiry added in v1.0.23

func (c Certificates) SortByExpiry() Certificates

func (Certificates) SubjectLike added in v1.0.24

func (c Certificates) SubjectLike(subject string) Certificates

type DistributionPoint added in v1.0.25

type DistributionPoint struct {
	DistributionPoint []string
	Reasons           []string
	CRLIssuer         []string
}

func ToCRLDistributionPoints added in v1.0.25

func ToCRLDistributionPoints(in []byte) ([]DistributionPoint, error)

type Extension added in v1.0.25

type Extension struct {
	Name     string
	Oid      string
	Critical bool
	Values   []string
}

type GeneralName added in v1.0.25

type GeneralName struct {
	Type  string // dns name, ip address, ...
	Value string
}

Jump to

Keyboard shortcuts

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