Skip to content

Interview question · Software, Data & Model Supply Chain

How does code signing work, what does it guarantee, and what happens when a signing key is stolen?

The mechanism takes a minute. The score comes from saying exactly what a valid signature does not prove, and running the key-theft response.

mediumEssentialNewPreparation tags: Microsoft, Apple, GoogleUpdated Nov 2026

TL;DR: The publisher hashes the artifact, signs the hash with a private key (kept in an HSM), attaches a certificate binding that key to its identity, and adds a trusted timestamp. The verifier rehashes, checks the signature, validates the certificate chain and timestamp, and applies policy. A valid signature guarantees the artifact is unchanged since signing and which key signed it, not that it is safe or built from reviewed source. If the key is stolen, attackers can sign malware as you: revoke the certificate from the compromise date, rotate to a new key in hardware, re-sign current releases, investigate what was signed, and tell customers which versions to trust.

How to approach it

Walk through signing and verification, then state guarantees and non-guarantees precisely, with one real-world example of each failure mode. Finish with the incident response for key theft, which is the part interviewers most want to hear.

A strong answer

FIG · CODE SIGNING · SIGN THE HASH, VERIFY THE CHAIN AND THE TIME
What a valid signature proves, and what a stolen key breaks

Publisher

HSM

Timestamp authority

Verifier

  1. Sign
  2. Publisher to HSM

    1Sign hash of artifact
1/3

1. Sign hash of artifact

Private key never leaves the HSM

Signing. Hash the artifact (SHA-256), sign the hash with the private key in an HSM, attach the code-signing certificate chain, and request an RFC 3161 timestamp so the signature remains verifiable after the certificate expires.

Verification. Recompute the hash; verify the signature with the certificate's public key; validate the chain to a trusted root with code-signing usage; confirm the certificate was valid at the timestamp and is not revoked; apply platform policy (allowed publishers, notarisation, store review).

Guarantees and non-guarantees.

A valid signature provesIt does not prove
No byte changed since signingThe code is free of malware or bugs
The holder of a key bound to this publisher signed itThe build used reviewed source (SolarWinds Orion, 2020: compromised build, legitimately signed updates)
When it was signed (with timestamping)The key was not stolen (Stuxnet, 2010: drivers signed with stolen vendor certificates)

Key theft response.

  1. Contain: disable the key in the HSM or revoke access; stop all signing until the scope is known.
  2. Scope: review signing logs to find every artifact signed during the exposure window; identify which were not produced by your release pipeline.
  3. Revoke: ask the CA to revoke the certificate with a revocation date at the start of the compromise, so earlier legitimate releases remain valid thanks to their timestamps and later signatures become invalid.
  4. Rotate and re-sign: issue a new key in hardware, re-sign current supported releases, publish them.
  5. Communicate: tell customers which versions and hashes to trust, and what to do with anything signed in the window.
  6. Fix the cause: how did the key leave its protection? Move to HSM-only keys if they were exportable, add approval gates on signing, and consider short-lived keyless signing for CI releases.

Prevention. Public code-signing keys must live in hardware under CA/Browser Forum requirements in force since June 2023; sign only in a dedicated, gated release job; log and alert on every signing operation; and add build provenance so consumers can check how an artifact was built, not just who signed it.

What interviewers probe next

  • "Why timestamping?" So signatures outlive certificate expiry, and so revocation can be dated to the compromise.
  • "How would Sigstore change this?" No long-lived key to steal; short-lived certificates tied to a CI identity, with every signature in a public log you can monitor.
  • "Does signing protect model files?" It proves who released them and that they are unchanged; it does not detect backdoored weights or unsafe pickle content.

What if?

What if · interview follow-ups

Hold your answer as the constraints change

Your company ships a desktop agent signed with a code-signing certificate, and the signing key currently lives as a file on a build server.

  1. Start here

    What does signing actually do?

How it's scored

Weak: Describes signing as encryption, or says signing proves software is safe.

Hire: Gives the hash-sign-verify flow with certificates, and separates integrity and origin from safety.

Strong Hire: Adds timestamping and its role in revocation, cites real build-compromise and key-theft cases, runs a complete key-compromise response, and connects to provenance and keyless signing.

Common mistakes

  • Storing signing keys in CI secrets or on developer machines.
  • Revoking a certificate without considering previously signed, legitimate releases.
  • Treating "signed" as "trusted" in deployment policy without checking the signer identity.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 10, and we keep track of how far you get in every topic.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in doubles your free answers, from 5 to 10 per topic, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

No comments yet. Share a correction or a different way to answer it.