Digital Signature
1. Why Do We Need a Digital Signature?
Real-world idea: two papers reach me — one has my signature, one doesn’t. The one with my signature is mine; the other may be fake / changed. A signature = confirmation of ownership.
Computer version: I send you a message — how does your device know it is really from Sir Taha and nobody else? ⇒ digital signature.
With a digital signature: Daraz checks the signature — if it is not Samad’s, something is wrong (hacking) ⇒ Daraz calls Samad: “this isn’t your signature.”
2. Public Key & Private Key (just the basics)
Everyone has two keys that work as a pair. A key is a mathematical random number generated specially for you. (Names like asymmetric encryption — no need to memorise.)
| Private key 🔑 | Public key 🔑 | |
|---|---|---|
| Who knows it? | only the owner (me) | every single person |
| Can someone else have it? | never — it is like my signature | yes, freely given |
| How others get it | they don’t | given at the handshake |
The door analogy (higher-tech door that uses 2 keys)
locked with PUBLIC key ⇒ opens only with the matching PRIVATE key
A key never opens what it locked itself — the opposite key of the pair does.
Checking ownership with the door
Only Sir Taha has Sir Taha’s private key. Suppose the door was locked with it:
- Prajwal tries Taha’s public key — door opens ⇒ locked by Taha’s private key ⇒ Taha’s door ✓
- Fawad (a thief) opens it with Taha’s public key, then locks it with his own private key. Now Taha’s public key won’t open it — only Fawad’s public key will ⇒ Prajwal knows it is not Taha’s door.
3. Proving Ownership by Encrypting an Email
Take an email from Sir Taha to Banu baji. Encrypt (= scramble) it with the sender’s private key and send it. Banu tries the sender’s public key — if the email decrypts, it was sent by the owner.
4. Hashing Algorithm
Analogy: bookmarks for chapters
To reach a chapter fast I make a short key using my own rule — “take the first letter of every word”.
| Content (chapter) | Key made by my rule |
|---|---|
| Hardware System | HS |
| Automatic Repeat Request | ARR |
| Database Management System | DBMS |
The short key stands for the whole chapter, and I use it to reach the content. A hashing algorithm does this for data.
A computer does not understand text — it only handles numbers (ASCII values are denary numbers → binary). So the rule has to be maths on numbers (add, subtract, multiply, divide…).
Toy example (for understanding only — do NOT learn this)
Number 05419722 → split into pairs and keep adding in loops:
Real algorithms are different (many exist — A2 level). Just imagine: a maths function (multiply, divide…) that shrinks any content into a small value. Using the key (like DBMS for the chapter) I can access the content it represents.
5. Creating a Digital Signature (Sender)
An email is text → numbers (ASCII) → binary, so it can go through a hashing algorithm.
- Put the email message through the hashing algorithm → hash key = digest (e.g. 54).
- Encrypt the digest with the sender’s private key → this is the digital signature.
- Send the email + digital signature to the receiver (“this is my signature, keep it”).
6. Checking the Signature (Receiver)
- Receiver has the email + the encrypted digest (the signature).
- Decrypt the signature with the sender’s public key → gives the sender’s digest (54). Decrypts ⇒ owner confirmed.
- Receiver puts the received email through the same hashing algorithm → makes its own digest.
- Compare the two digests.
| Benefit | How it is checked | Result |
|---|---|---|
| ① Ownership / authentic | signature decrypts with sender’s public key | sent by that sender ✓ |
| ② Not altered (integrity) | digest A = digest B | content unchanged ✓ |
7. Exam Answers — Past-Paper Questions
The whole concept was for these lines. Learn the wording — sir read it as the model answer.
Explain how a digital signature is used to ensure an email is authentic.
- Email message is put through a hashing algorithm to produce a digest.
- The digest is encrypted with the sender’s private key to create the digital signature.
- The digital signature can only be decrypted with the matching sender’s public key ⇒ confirms the sender (ownership).
Explain how a digital signature is used to ensure that data is not altered.
- Email message put through the agreed hashing algorithm to produce a digest.
- Digest is encrypted with the sender’s private key to create the digital signature.
- Digital signature (sent with the message) is decrypted with the public key of the sender ⇒ ownership confirmed.
- Receiver passes the received email through the same hashing algorithm to produce a digest.
- The sender’s digest and the receiver’s digest are compared; if both are the same, the data has not been altered.
- Purpose: confirm ownership (who sent it) + that data was not altered — not to hide or protect access.
- Keys: private = only owner (like a signature); public = everyone has it. Lock with one ⇒ open with the other.
- Hashing algorithm: maths function ⇒ short hash key = digest; same algorithm on both sides (agreed).
- Create: email → hash → digest → encrypt with sender’s private key = digital signature → send with email.
- Check: decrypt signature with sender’s public key ⇒ owner ✓; hash received email ⇒ compare digests ⇒ same ⇒ not altered ✓.
- Different digests (54 vs 64) ⇒ someone altered the content in transit.
- A2 has the detailed theory — AS only needs the 3-line answer.