Help us shape the future of Go! Take the 2026 Go Developer Survey

security

package
v0.12.7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTrustBundle

func LoadTrustBundle(pemPath string) (*x509.CertPool, error)

LoadTrustBundle loads a PEM bundle of trusted roots into a CertPool.

func VerifyDetached

func VerifyDetached(filePath, sigPath, leafCertPath string, roots *x509.CertPool) error

VerifyDetached verifies the signature of a file using a provided leaf certificate and trust bundle. The signature is expected to be over the SHA-256 digest of the file content. Signature file may be raw bytes or base64-encoded; both are supported.

Certificate validity is judged against the system clock. On a device that may have no reliable clock, use VerifyDetachedAt with a time the caller can defend — see internal/clock.

func VerifyDetachedAt added in v0.7.0

func VerifyDetachedAt(filePath, sigPath, leafCertPath string, roots *x509.CertPool, now time.Time) error

VerifyDetachedAt is VerifyDetached with an explicit time for the certificate validity check. The zero time means "use the system clock", which is what x509 does with an unset CurrentTime.

This exists because a gateway with no RTC boots at 1970 and would reject every valid certificate as not yet valid. Passing the time in — rather than reading the clock here — also means the decision about what time to believe lives in one place instead of being made implicitly at each call site.

Types

This section is empty.

Jump to

Keyboard shortcuts

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