Skip to main content

✍️ Wax Seals

Cryptographic Signatures Explained

In 10 minutes: Understand how to verify message senders
Prerequisite: Public/Private Keys + Hash Functions


🎯 The Simple Story

Alice receives a message: "Hello Bob, it's Alice"

Problem: Eve could have sent this pretending to be Alice!

Solution: Cryptographic signatures (like wax seals on letters)!

  1. Alice computes: Signature = Sign("Hello Bob, it's Alice", Alice_PRIVATE_KEY)
  2. Alice sends: Message + Signature
  3. Bob receives both
  4. Bob uses Alice's public key to verify: Verify(Message, Signature, Alice_PUBLIC_KEY)
  5. If verification succeeds, Bob knows Alice signed it!
  6. Eve can't forge Alice's signature without Alice's private key!

Just like a wax seal that only Alice can make!


🧠 Mental Model

Hold this picture in your head:

Cryptographic Signatures:

Alice wants to send: "Hello Bob"

Alice:
"Hello Bob" + Alice's private key

Sign("Hello Bob", Alice_PRIVATE_KEY)

Signature: "Xj7$a9p..."

Bob receives:
Message: "Hello Bob"
Signature: "Xj7$a9p..."

Bob verifies:
Verify("Hello Bob", "Xj7$a9p...", Alice_PUBLIC_KEY)

✅ Valid! Alice signed it
OR
❌ Invalid! Not Alice's signature

Eve tries:
Eve signs: Sign("Hello Bob", Eve_PRIVATE_KEY)

Signature: "B3k$z9m..."

Bob verifies: Verify(..., Alice_PUBLIC_KEY)

❌ Invalid! Eve's signature, not Alice's!

Think of it like:

✍️ Wax seal (Only Alice has her seal stamp)

🗣️ Voice verification (You know Alice's voice, not Eve's) 🎫 Movie ticket (Only Alice has the original)


📊 See It Happen

Let's watch a cryptographic signature in action:


🎭 The Story: The Impersonator

Alice is in love with Bob. She wants to send: "I love you, marry me!"

Eve wants to break them up. Eve wants to send Bob: "I hate you, I'm leaving you!" pretending it's Alice.

Without signatures:

  1. Alice sends: "I love you, marry me!"
  2. Eve intercepts and changes: "I hate you, I'm leaving you!"
  3. Bob receives: "I hate you, I'm leaving you!"
  4. Bob is heartbroken!
  5. Bob never knows Alice loved him!

With signatures:

  1. Alice sends: "I love you, marry me!" + Signature_Alice
  2. Eve intercepts and tries to change message
  3. Eve changes: "I hate you, I'm leaving you!" + Signature_Alice
  4. Bob receives and checks: Is this signature valid for this message?
  5. Bob computes: Verify("I hate you, I'm leaving you!", Signature_Alice, Alice_PUBLIC_KEY)
  6. Bob checks: Is this Alice's real signature?
  7. Bob: No! Alice's signature doesn't match "I hate you..."
  8. Bob: "This isn't from Alice! Eve is trying to trick me!"
  9. Bob rejects the message!

Result: Bob knows Eve tried to impersonate Alice!


🎮 Try It Yourself

Question 1: Alice signs "I love you" with her private key. Can Eve verify Alice's signature?

Show Answer

Yes, Eve can verify Alice's signature!

Verification needs Alice's public key (she published it). Anyone with Alice's public key can verify Alice's signatures.

But Eve cannot forge Alice's signature without Alice's private key.

Key difference:

  • Verify: Anyone can do (uses public key)
  • Sign: Only Alice can do (uses private key)

Answer: Eve can verify, but cannot forge


Question 2: Eve has Alice's message and signature. What does Eve create with her own private key?

Show Answer

Eve creates her own signature, but it won't verify with Alice's public key!

Example:

  • Alice's message: "I love you"
  • Alice's signature: "Xj7$a9p..." (using Alice_PRIVATE_KEY)
  • Eve tries to forge: "I love you" + "B3k$z9m..." (using Eve_PRIVATE_KEY)

Bob checks: Is "B3k$z9m..." Alice's signature for "I love you"?

  • Bob verifies: Verify("I love you", "B3k$z9m...", Alice_PUBLIC_KEY)
  • Result: ❌ Not Alice's signature!

Answer: Eve creates a signature, but it won't verify as Alice's


Question 3: How does Bob know to check the message against Alice's signature?

Show Answer

Because Bob needs Alice's public key to verify!

Bob stored Alice's public key earlier (from a trusted source):

  • Maybe Bob got Alice's public key directly (met in person)
  • Maybe a certificate authority verified it
  • Maybe it's in the X3DH process (we'll learn this later!)

When Bob receives:

  • Message: "I love you"
  • Signature: "Xj7$a9p..."
  • Public key: Alice's Bob has stored

Bob can verify: Verify("I love you", "Xj7$a9p...", Alice_PUBLIC_KEY)

Answer: Bob uses Alice's public key to verify who signed it


🔢 The Math

Signature Generation (Signing)

Using Alice's private key (sk_Alice):

Signature(message, sk_Alice):
H = Hash(message)
Signature = DigitalSignature(H, sk_Alice)
Return Signature

Verification

Using Alice's public key (pk_Alice):

Valid = Verify(message, signature, pk_Alice):
H = Hash(message)
Check: Does signature verify with pk_Alice?

If yes: Return ✅ Valid (Alice signed it)
If no: Return ❌ Invalid (Not Alice's signature)

Properties

1. Authenticity: Only the private key holder (Alice) can create valid signatures.

2. Unforgeability: Eve cannot forge Alice's signature without Alice's private key.

3. Non-repudiation: Alice can't deny she signed it (only she has private key).

4. Integrity: If the message changes, the signature no longer verifies.


💡 Why We Care

Real-World Uses

Use CaseHow It WorksExample
Email securitySign email, verify senderKnow it's not spam/fake
Digital contractsSign documentsLegal proof of agreement
Software updatesSign softwareVerify no tampering
Signal ProtocolVerify message sendersKnow it's actually Alice

Signal Protocol Use

In X3DH (learn next):

  • Alice verifies Bob's signed pre-key using Bob's signature
  • This ensures Eve hasn't replaced Bob's public key with her own!

Without this, Eve could impersonate Bob (replace Bob's keys with hers) and Alice would be talking to Eve instead of Bob!


✅ Quick Check

Can you explain signatures to a 5-year-old?

Try saying this out loud:

"Imagine Alice has a special stamp with her name on it. She writes a letter and stamps it with her special stamp. Bob gets the letter and checks the stamp. If the stamp is Alice's special stamp, he knows Alice really wrote it! Eve can't make Alice's special stamp because only Alice has it!"

Why verify?

Example:

Alice: "Transfer 100toBob"+AlicessignatureEve:Changesto"Transfer100 to Bob" + Alice's signature Eve: Changes to "Transfer 100 to Eve" + Alice's signature

Bob checks: Does "Transfer $100 to Eve" match Alice's signature?

  • Bob: ❌ No! Alice's signature wouldn't verify for "Transfer $100 to Eve"
  • Bob: "Eve is trying to trick me!"

📋 Key Takeaways

Signatures = Prove who sent the message
Signing = Only Alice can do (uses private key)
Verifying = Anyone can do (uses public key)
Forgery impossible = Eve can't create Alice's signatures
Detects tampering = Signature only verifies for original message
Metaphor = Wax seal on letter
Signal Protocol = Verifies Bob's keys in X3DH handshake


🎉 What You're Ready For

Congratulations! You've completed the cryptography foundations! You now understand:

  1. ✅ Public/Private Keys (mailboxes)
  2. ✅ Diffie-Hellman (color mixing)
  3. ✅ Symmetric vs Asymmetric (when to use each)
  4. ✅ Hash Functions (digital fingerprints)
  5. ✅ Cryptographic Signatures (wax seals)

Now you're ready for the Signal Protocol!

🤝 Continue: What is X3DH

We'll learn the Extended Triple Diffie-Hellman protocol - how Alice and Bob establish initial trust!


Foundations complete! Now let's learn X3DH - how Signal Protocol establishes initial trust!