Code Signing
Code signing is attaching a digital signature to software so users and systems can verify who published it and that it hasn't been altered since it was signed. It doesn't prove the code is safe, only where it came from.
Also called: digital code signing, code signing certificate, signed software, Authenticode
What is code signing?
When you download and install software, how do you know it really came from the publisher, and that nobody slipped malware into it along the way? Code signing answers both questions. NIST's paper on code signing describes its two purposes as integrity, showing the code hasn't been modified, and source authentication, identifying who signed it.
Operating systems rely on it heavily. Windows shows the verified publisher before installing an app and warns about unsigned software; macOS and mobile app stores require signed apps; and software updates, drivers and firmware are checked before they're installed.
How it works
- A software publisher gets a code signing certificate from a certificate authority, which verifies the publisher's identity. See digital certificate and PKI.
- At release, the publisher creates a hash of the software and encrypts it with their private key, producing a signature attached to the file.
- A timestamp records when it was signed, so the signature stays valid after the certificate expires.
- When you run the software, your computer uses the publisher's public key to check the signature. If even one byte has changed, verification fails.
Its limits
A signature proves who signed the code, not that the code is safe:
- Stolen signing keys let attackers sign malware that appears legitimate. NIST lists key theft as a top threat, and stolen certificates from real companies have been used to sign malware many times.
- Compromised build pipelines can produce signed malware. In the SolarWinds attack, the backdoored update was properly signed, because the malicious code was inserted before signing. That's why CI/CD security matters too.
- Attackers can obtain certificates for shell companies.
Best practices for publishers
NIST recommends:
- Protect private keys in hardware, such as hardware security modules. Industry rules now require code signing keys to be stored on hardware.
- Limit who and what can sign, and log every signing operation.
- Review code before signing.
- Always timestamp signatures.
- Revoke certificates immediately if a key is compromised.
For everyone else: be cautious with unsigned software, and don't click through publisher warnings without checking.
Related terms
Sources
Drafted with AI assistance, then edited and fact-checked by a person. How we use AI.
