Code signing
Also known as: software signing
Adding a digital signature to software so users and systems can check who made it and that nobody changed it afterwards.
Draft - this entry has not been reviewed yet.
Formal
The publisher computes a hash of a program, update, script or container image and signs it with a private key tied to a digital certificate; before installing or running it, the system checks the signature and certificate and refuses the file on any mismatch.
In plain English
Like the seal on a medicine bottle printed with the maker's name - if the seal is broken or the name is wrong, you do not swallow what is inside.
In practice
A municipality's IT operations team lets staff computers run only software signed by approved publishers; when a fake “update” arrives by email, Windows refuses to start it because the signature is missing.
How to put it into practice
The usual steps, in order. Adapt them to your organisation.
- List everything you publish or run that can be signed - installers, executables, scripts, packages, container images and release files - and decide which of them must be signed.
- Choose the signing method per platform, such as Authenticode for Windows, codesign with notarisation for Apple, Sigstore cosign or Notation for container images, and the package manager's own signing for packages.
- Generate and keep private signing keys in an HSM or a cloud key service (required for publicly trusted code-signing certificates since 1 June 2023), or use keyless Sigstore signing tied to the CI workflow's identity.
- Sign only in a hardened release pipeline, never on developer machines, and require a separate approval for each signing of a production release.
- Add an RFC 3161 timestamp to every signature so it stays valid after the certificate expires, and plan certificate renewal, since publicly trusted certificates are limited to 460 days since 1 March 2026.
- Publish build provenance (SLSA) and an SBOM together with the signed artefact, so recipients can see how and from what it was built.
- Enforce verification where the code runs - App Control for Business or AppLocker on Windows, Gatekeeper on macOS, signature checks in package managers and a Kubernetes admission controller that rejects unsigned images or an unexpected signer.
- Write and rehearse a procedure for a stolen key - revoke the certificate with an invalidity date, re-sign affected releases with a new key and inform customers.
Common pitfalls
- Treating a valid signature as proof that the code is safe, although a compromised build system signs malicious code just as validly.
- Keeping signing keys as files on build servers or laptops, where malware can copy them.
- Signing everything but never checking signatures where software is installed or run.
- Checking only that a Sigstore signature exists, without checking the expected signer identity and issuer.
Good guides
Technical deep dive
Every code-signing scheme applies a digital signature over a digest of the artefact, but formats differ by platform. Microsoft Authenticode (introduced 1996) embeds a PKCS#7/CMS SignedData structure in the PE file's certificate table, hashing the file while excluding the checksum and the signature area itself; Apple's codesign stores a code directory of per-page hashes and requires notarisation for Gatekeeper; Java signs JAR manifests; Linux distributions sign repository metadata or packages with OpenPGP keys; Android uses the APK Signature Scheme v2 and later, which covers the whole archive. The signer's X.509 certificate must carry the codeSigning extended key usage (OID 1.3.6.1.5.5.7.3.3) and chain to a root in the verifier's trust store.
Timestamping solves the expiry problem. A signature is sent to a Time-Stamping Authority per RFC 3161, which countersigns the signature's hash with a trusted time; verifiers then accept the signature after the certificate expires, as long as it was valid at the timestamp. It also shapes revocation: when a key is compromised, the CA can revoke with an invalidity date so that only signatures timestamped after the compromise fail. Publicly trusted code-signing certificates are governed by the CA/Browser Forum's Code Signing Baseline Requirements, which since 1 June 2023 require the subscriber's private key to be generated and kept in a hardware crypto module (HSM, token or cloud HSM service) and since 1 March 2026 limit certificate validity to 460 days.
Sigstore, an OpenSSF project, provides "keyless" signing aimed at open-source and container supply chains: cosign obtains an OIDC token for the signer's identity (a person's email or a CI workflow identity), Fulcio issues a certificate for an ephemeral key valid for about ten minutes, the signature and certificate are recorded in the Rekor transparency log, and verifiers check both the expected identity and issuer and the log inclusion. Notary Project's notation offers a PKI-based alternative for OCI artefacts; npm, PyPI and Maven Central have adopted Sigstore-based provenance or signatures in various forms.
The key limitation is that a signature attests to who signed, not to what the code does. Stolen keys have signed malware (Stuxnet used certificates stolen from Realtek and JMicron), and compromised build systems produce perfectly valid signatures on malicious code, as with SolarWinds Orion in 2020 and the 3CX desktop client in 2023. Effective programmes therefore protect keys in HSMs with separate approval for each signing operation, sign only in hardened release pipelines rather than on developer machines, pair signatures with build provenance (SLSA) and SBOMs, and enforce verification at the consumer: Windows Defender Application Control or AppLocker policies, macOS Gatekeeper, package-manager signature checks and Kubernetes admission controllers that reject unsigned images.
What to learn first
Everything this builds on, foundations first.
Relationships
- Part of
- Software supply chain
Sources & further reading
Standards & official texts
Official documentation
- Sigstore documentation · OpenSSF
Where this data comes from
This entry was drafted by an AI from the sources above and has not yet been checked by a person. Treat it as a starting point, and check anything important against the sources.
See the review queueSuggest a correction on GitHubThis term as JSON
Check yourself
Loading…