Security

What is digital signature?

A digital signature is a hash of data signed with the signer's private key; anyone with the public key can verify it, proving integrity and origin.

What is a digital signature?

A digital signature is a cryptographic value attached to a message, file or certificate that proves two things: the content has not changed since it was signed, and it was signed by whoever holds a particular private key. Anyone with the matching public key can check it. Operating systems use signatures to decide whether to install updates and drivers, browsers use them to validate certificates, and email clients use them to show that a message really came from the named sender.

How signing and verification work

  1. The signing software hashes the content, typically with SHA-256 or stronger.
  2. The signer's private key signs that digest. With RSA this is often described as encrypting the hash with the private key; ECDSA and EdDSA use different math but likewise produce a value only that private key could create.
  3. The verifier hashes the received content again and uses the signer's public key to check the signature against the new hash. A match means the content is intact and the signature came from that key.

Hashing first keeps signing fast and fixed in size, whether the input is a one-line message or a 4 GB disk image. It is also why collision resistance matters: two files with the same hash would share a signature, so MD5 and SHA-1 are not used for new signatures. Current algorithms are RSA with 2048-bit or larger keys, ECDSA on P-256 or P-384, and EdDSA, usually Ed25519. NIST's FIPS 186-5 no longer approves the older DSA for creating new signatures.

A signature check from the command line

With OpenSSL, a release file can be signed with a private key and checked with the public key:

openssl dgst -sha256 -sign release.key -out app.sig app.bin

openssl dgst -sha256 -verify release.pub -signature app.sig app.bin

The second command prints Verified OK. If even one byte of app.bin changes after signing, the same command prints Verification failure. Windows administrators get a similar verdict from the PowerShell cmdlet Get-AuthenticodeSignature, which reports Valid for an intact file whose signature chains to a trusted root, HashMismatch for a file altered after signing and NotSigned for an unsigned one.

What a digital signature proves, and what it does not

  • Integrity: any change to the signed content breaks verification.
  • Authentication of origin: the content came from the holder of the private key.
  • Non-repudiation: because only the signer holds the key, the signer cannot credibly deny signing. This depends on protecting the key, for example on a smart card, in a TPM or in an HSM.

A signature provides no confidentiality. A signed email is as readable as an unsigned one. Secrecy needs encryption with the recipient's public key, and a message that needs both is signed with the sender's private key and encrypted to the recipient. A signature also does not prove content is safe: in the 2020 SolarWinds compromise, the backdoored Orion update carried a valid SolarWinds signature because the attackers had tampered with the build process before signing.

Digital signature vs. HMAC vs. electronic signature

A plain hash detects change but proves nothing about who made it. An HMAC adds a shared secret key, so it proves the message came from someone holding that key, but either party could have produced it, which rules out non-repudiation. A digital signature uses a key pair, so only one party could have created it. An electronic signature in the everyday sense, such as a typed name or a pasted image of a handwritten signature, is a legal and business concept that offers no cryptographic proof by itself.

Digital signature on the CompTIA Security+ exam

Digital signatures fall under SY0-801 objective 1.3, which is about choosing cryptographic tools and knowing what each one provides. The most tested point is key direction: the sender signs with their own private key, and the recipient verifies with the sender's public key. Wording such as "prove the CFO approved it", "the sender cannot deny sending it" or "confirm the update came from the vendor and was not altered" points to a digital signature. "Only the recipient can read it" points to encryption with the recipient's public key instead. Distractors include a hash alone, HMAC when non-repudiation is required, and any answer that signs with a public key.

Studying for CompTIA (Security)?

ExamWizardz turns the official objectives into a guided study plan — with practice tests, realistic PBQs, and a readiness score. Start free.

Start studying free

Related terms