cert

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 17 Imported by: 8 modules, 12 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

SHIP 9.1: the ciphers are reported insecure but are defined to be used by SHIP

Functions

func CreateCertificate

func CreateCertificate(organizationalUnit, organization, country, commonName string) (tls.Certificate, error)

Create a ship compatible self signed certificate organizationalUnit is the OU of the certificate organization is the O of the certificate country is the C of the certificate commonName is the CN of the certificate Example for commonName: "deviceModel-deviceSerialNumber"

func FingerprintFromCertificate added in v0.7.0

func FingerprintFromCertificate(cert *x509.Certificate) (string, error)

FingerprintFromCertificate calculates SHA-256 fingerprint of the given certificate Per SHIP spec section 6.2: SHA-256 hash of DER-encoded certificate Returns uppercase hex string as required by SHIP spec

func IsFingerprintFormatValid added in v0.7.0

func IsFingerprintFormatValid(fingerprint string) bool

func IsSkiFormatValid added in v0.7.0

func IsSkiFormatValid(ski string) bool

func LogCertificateExpiration added in v0.7.0

func LogCertificateExpiration(cert *x509.Certificate, ski string)

LogCertificateExpiration logs certificate expiration warnings according to SHIP spec 12.1.1 This logs warnings but does not affect the connection (per spec: "SHOULD still allow communication")

func SkiFromCertificate

func SkiFromCertificate(cert *x509.Certificate) (string, error)

func ValidateFingerprint added in v0.7.0

func ValidateFingerprint(cert *x509.Certificate, expectedFingerprint string) error

ValidateFingerprint validates that a certificate matches the expected fingerprint expectedFingerprint must be a 64-character uppercase hex string per SHIP spec

Types

type CertificateExpirationInfo added in v0.7.0

type CertificateExpirationInfo struct {
	Status              CertificateExpirationStatus
	IsExpired           bool
	ExpiresWithin30Days bool
	DaysUntilExpiration int
	ExpirationDate      time.Time
}

CertificateExpirationInfo contains detailed information about certificate expiration

func CheckCertificateExpiration added in v0.7.0

func CheckCertificateExpiration(cert *x509.Certificate) CertificateExpirationInfo

CheckCertificateExpiration checks the expiration status of a certificate

type CertificateExpirationStatus added in v0.7.0

type CertificateExpirationStatus int

CertificateExpirationStatus represents the expiration status of a certificate

const (
	// CertificateValid indicates the certificate is valid and not expiring soon
	CertificateValid CertificateExpirationStatus = iota
	// CertificateExpiringSoon indicates the certificate will expire within 30 days
	CertificateExpiringSoon
	// CertificateExpired indicates the certificate has already expired
	CertificateExpired
)

Jump to

Keyboard shortcuts

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