Cryptography Essentials

Public-Key Cryptography

Public-Key Cryptography

Module 2 of Cryptography


The Key Exchange Problem

Before public-key cryptography, secure communication required sharing a secret key through a secure channel.

The paradox: To communicate securely, you need to share a key securely. But if you had a secure channel, why do you need encryption?


The Breakthrough: Asymmetric Cryptography

Key pair:

  • Public key: Share with everyone
  • Private key: Keep absolutely secret

Magical property:

  • What one key encrypts, only the other can decrypt
  • Knowing the public key doesn't reveal the private key

Digital Signatures

Signatures prove:

  1. Authentication: The message came from the key owner
  2. Integrity: The message wasn't modified
  3. Non-repudiation: The signer can't deny signing

How It Works

Signing (with private key):

signature = sign(message, private_key)

Verification (with public key):

valid = verify(message, signature, public_key)

Key Takeaways

  1. Public-key crypto uses key pairs: Public (share freely) + Private (keep secret)
  2. Private key = Identity: Whoever has it controls the funds
  3. Digital signatures prove ownership without revealing the private key
  4. Key management is critical: You are your own bank