certinfo

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 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

Overview

Package certinfo describes an X.509 certificate's public metadata: identity, validity, key algorithm and size, signature algorithm, names and flags.

It is the single place these facts are worked out. The TLS scanner (a certificate a server presented) and the host certificate sensors (a certificate a machine holds) both call it, so the same certificate yields the same attributes whichever way it was found, which is what lets the estate graph treat the two sightings as one entity.

It reads a parsed certificate and nothing else: no key material, no network, no operating system, no file. It has no way to describe a private key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicConstraints

type BasicConstraints struct {
	CA         bool
	MaxPathLen int // -1 when absent
}

BasicConstraints is the basicConstraints extension.

type Extension added in v0.3.0

type Extension struct {
	OID      string
	Critical bool
	Name     string
}

Extension is one extension a certificate carries: its OID, whether it is critical, and the name this program decodes it by ("" when it does not decode it).

type Facts

type Facts struct {
	Subject     string
	Issuer      string
	SerialHex   string
	DNSNames    []string
	IPAddresses []string
	NotBefore   time.Time
	NotAfter    time.Time
	IsCA        bool
	SelfSigned  bool
	SHA256      string // lower-case hex over the DER encoding: the certificate's identity
	KeyUsage    []string

	KeyAlgorithm string // RSA, ECDSA, Ed25519, ... or "unknown"; never guessed
	KeyOID       string // the SubjectPublicKeyInfo algorithm OID
	KeyBits      int    // 0 when the key size is not known
	Curve        string // named curve of an ECDSA key
	SigName      string
	SigOID       string

	OCSPServers    []string
	IssuerURLs     []string
	CRLPoints      []string
	OCSPMustStaple bool
	EmbeddedSCTs   bool

	SPKISHA256       string   // lower-case hex over SubjectPublicKeyInfo: the key's identity across certificates
	ExtKeyUsage      []string // RFC 5280 names ("serverAuth"), or the OID for one without a name
	BasicConstraints *BasicConstraints
	NameConstraints  *NameConstraints
	Policies         []string // certificate policy OIDs
	PolicyClass      string   // DV, OV, IV or EV from the CA/Browser Forum policy OIDs; "unknown" otherwise
	CNOnly           bool     // a subject CN and no subjectAltName at all
	Wildcards        []string // DNS SANs that are wildcards
	LifetimeDays     int      // validity period in days, rounded up (notBefore and notAfter both inclusive)
	RSAExponent      int      // public exponent of an RSA key, else 0

	SigParams    string      // RSASSA-PSS parameters in words (RFC 8017 A.2.3), "" for other signatures
	AuthorityKey string      // authorityKeyIdentifier keyIdentifier, hex
	SubjectKey   string      // subjectKeyIdentifier, hex
	Extensions   []Extension // every extension, by OID, decoded or not
}

Facts is what a certificate says about itself. Text fields come from the certificate and are attacker-controlled: callers clean and bound them before they travel further.

func Describe

func Describe(c *x509.Certificate) Facts

Describe reads a parsed certificate.

type NameConstraints

type NameConstraints struct {
	Critical  bool
	Permitted []string
	Excluded  []string
}

NameConstraints is the nameConstraints extension, flattened to strings.

Jump to

Keyboard shortcuts

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