Documentation
¶
Overview ¶
Package authenticode checks Windows code signatures for the self-updater: the candidate must carry a valid, timestamped Authenticode signature whose leaf signer subject equals the running updater's own signer subject, so no publisher is hard-coded and a Trusted Signing certificate rotation (same subject, new key) keeps working.
Trust (chain, digest) AND the signer subject come from WinVerifyTrust: the subject is read from the leaf of the chain it validated (provider data), never from the PE's certificate bag, which lies outside the signed digest and can carry look-alike certificates. The bag is still parsed in Go to reject an ambiguous signer (two distinct certs with the signer's issuer+serial; an identical duplicate is the same cert) and to recognise an RFC 3161 timestamp WinVerifyTrust doesn't count.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsigned means the file has no Authenticode signature. ErrUnsigned = errors.New("authenticode: file is not signed") // ErrNotTimestamped means the signature has no countersignature // timestamp, so it stops validating when the signing cert expires. ErrNotTimestamped = errors.New("authenticode: signature is not timestamped") // ErrUntrusted means WinVerifyTrust rejected the signature. ErrUntrusted = errors.New("authenticode: signature not trusted") // ErrPublisherMismatch means the candidate's signer differs from ours. ErrPublisherMismatch = errors.New("authenticode: publisher differs from the running updater") // ErrNoPublisher means the running updater has no signer to compare // against (an unsigned dev build) and no test pin is configured. ErrNoPublisher = errors.New("authenticode: running updater is unsigned; refusing updates") // ErrAmbiguousSigner means the certificate bag holds more than one // distinct certificate matching the signer's issuer+serial (or key id). ErrAmbiguousSigner = errors.New("authenticode: signer certificate is ambiguous") // ErrUnsupported is returned off Windows, where WinVerifyTrust is absent. ErrUnsupported = errors.New("authenticode: verification is only supported on Windows") )
Functions ¶
func SamePublisher ¶
SamePublisher verifies candidate and checks that its leaf subject equals the subject of self (the running updater). A selfupdate_testkeys build may pin the expected subject instead (DMG_TEST_AUTHENTICODE_SUBJECT). An unsigned self with no pin refuses every candidate.
func SameSeedPublisher ¶
SameSeedPublisher is the publisher rule for adopting an MSI seed: as SamePublisher, except that an unsigned running binary (a dev or CI build, which has no publisher to compare) accepts the seed. The seed was installed by the MSI into an admin-only directory; its copy is still checked against hashes of the source.
Types ¶
type Signature ¶
Signature describes a file's primary Authenticode signature.
func Inspect ¶
Inspect reads the primary signature of a PE file without checking trust: the bag's signer subject and whether it carries a timestamp. It is not a publisher decision (the bag is outside the signed digest); Verify uses it only to reject an ambiguous signer and to spot RFC 3161 timestamps.