Digital signatures
A signature on paper doesn't prove much: anyone who's seen yours once can copy it. A digital signature is different. It proves the text came from you and that not a single letter has changed since — and faking it is just as impossible as counting backwards on the curve from the previous chapter. Because that's exactly what it uses.
Words you might need
- Signing
- Using your private key to make a kind of seal over a text. The seal is a number that belongs to exactly that text and exactly that key.
- Verifying
- Using the public key to check that the seal is correct. Anyone can do that, because anyone may have the public key. If it checks out: the text is genuine and unchanged. If it doesn't: something's been altered, or someone else signed it.
- ECDSA
- The name of the signature system that runs on elliptic curves. The EC stands for elliptic curve. This is what your ID card uses.
- Certificate
- A statement from a trusted authority: "this public key belongs to this person". Signed by that authority itself, too. Without a certificate you know someone signed it, but not who.
The lock in reverse
In the chapter on asymmetric keys, anyone could click your padlock onto a box, and only you could open it again with your private key. A signature flips that around: you do something with your private key, and anyone can use your public key to check that it was you. Because only whoever holds the private key can make a seal that matches the corresponding public key.
What a signature does and doesn't prove
| Does | Doesn't |
|---|---|
| That the signer held the private key. | Who that person is. You need a certificate for that. |
| That the text is letter-for-letter the same as when it was signed. | That the text is true. You can perfectly sign a lie. |
| That the signer can't deny it afterwards. | When it happened. That's what a timestamp is for. |
Try it yourself
Everything happens in your browser. Nothing is sent to the server.
- Click Make a key pair. Notice how much shorter this public key is than RSA's — that's the curve.
- Click Sign. You get a 64-byte seal.
- Click Verify. Valid.
- Now change one letter in the text — a period, a capital letter — and click Verify again, without signing again. Invalid. There's no "almost right".
- Put the text back and click Sign twice. Two different seals for the same text — and yet both valid.
From key to person
A valid signature says: "someone with that private key signed this". But who is that? That's where the certificate comes in. The Belgian State says: "this public key belongs to Koen Thomeer, born on such-and-such date" — and signs that statement itself. Want to be sure it really was the State? Then you check that signature against the State's key. This gives you a chain of trust that ends at one key you simply have to believe: the root. On your ID card, those certificates sit in the chip, next to your keys.
Two keys on your card, on purpose
| Key | What for | What it means |
|---|---|---|
auth |
Logging in: proving it's you | Not a signature under a document. Just "yes, this is me". |
sign |
Signing documents | Legally just as valid as your signature with a pen. Irrevocable. |
That's why your card sometimes asks for your PIN twice, and why the
second time matters more. Logging into a website uses auth.
Signing a contract uses sign, and that one you can never
undo. In the final chapter you'll do both with your own card.
This is math: proving you know something without saying it
Your private key is a number n. Your public key is the point n·P on the curve. A signature is a calculation in which n is hidden in such a way that anyone with n·P can check that you know n — without n ever coming out. And that randomness from step 5? Every signature uses a fresh random number; without it, n leaks out anyway. That actually happened in 2010 with the PlayStation 3, whose master key leaked because of it. One missing random number, and a multi-billion-dollar company was wide open. Math doesn't forgive sloppiness.