Digital signatures
Alice signs with her private key. Anyone with her public key can check that the message comes from her and was not changed. Only Alice can produce the signature.
Signing and verifying
Genuine ECDSA P-256 Simulated networkConceptual view The browser's ECDSA operation computes the SHA-256 hash internally and signs it. The hash shown here is that same SHA-256 value, displayed so you can see the step.
Signature lab
Genuine signing and verification Simulated network and attackerWhat happened
Could Bob fake it? HMAC versus signature
GenuineBob wants to claim that Alice wrote: "Alice owes Bob €5 000". Let him try both mechanisms.
With HMAC (Tool 2)
Alice and Bob share one secret key. Bob computes the tag himself.
With a digital signature
Bob only has Alice's public key. He can only sign with his own private key.
Key ideas
Sign with the private key
Only Alice holds her private key, so only she can create a signature that matches her public key.
Verify with the public key
Anyone with Alice's public key can verify. No secret is needed to verify.
Hashing inside
The message is first hashed (Tool 1); the hash is signed. A changed message gives a different hash, so the signature no longer fits.
Integrity and authenticity
A valid signature shows the message was not changed and was signed with the private key belonging to that public key.
Different each time
ECDSA uses a fresh random number for each signature. Signing the same message twice gives two different signatures, and both are valid. This is not a bug.
Non-repudiation, with limits
Because only Alice has the private key, she cannot easily deny signing. But only if her key was not stolen, and only if we know the public key really is hers (Tool 8). Laws such as eIDAS add requirements for legally binding signatures.
Encrypting versus signing
| Asymmetric encryption (Tool 4) | Digital signature | |
|---|---|---|
| Goal | Confidentiality: only the recipient can read | Integrity and authenticity: who wrote it, unchanged |
| Sender uses | The recipient's public key | Their own private key |
| Receiver uses | Their own private key | The sender's public key |
| Message readable on the network? | No | Yes, a signature hides nothing |
Common misconceptions
Where you meet digital signatures
Code signing
Windows shows the "verified publisher" of a program from its signature. Software updates are signed so that only the vendor can publish them.
HTTPS
The server signs the handshake, and Certificate Authorities sign certificates (Tool 8).
Signed documents
PDF signatures and e-ID cards (such as the Luxembourg eID or LuxTrust) create legally recognised electronic signatures.
E-mail and Git
S/MIME and PGP sign e-mails; developers sign Git commits so others know who really wrote them.
Challenges
1. Three ways to fail
In the lab, make the verification fail in three different ways. For each one, explain in one sentence what Bob can conclude.
Show answer
2. The secret contract
Alice wants to send Bob a contract that only Bob can read, and that Bob can prove she signed. Which keys does she use?
Show answer
3. Whose key is it?
Mallory publishes a public key and claims it is Alice's. Bob verifies a message signed by Mallory with this key: valid! What went wrong?