Open the editor

Computer science · High school

Public-Key Cryptography Slides

Free animated slides, ready to teach: 6 slides where every step appears on a click and the diagrams move. Play them right here, present them full screen, or copy them into your account to edit.

A real Tracé deck playing in your browser. No account needed.

What the lesson covers

Public-key cryptography gives everyone a public key to encrypt with, while only the owner holds the private key that decrypts. Students follow a key exchange, see why it rests on how hard it is to factorise big numbers and run RSA with small primes.

The slides, one by one

1 Public-key cryptography

Lock with one key, unlock with another

How can two strangers agree a secret over a public network?

2 Anyone can lock; only the owner can unlock

\textsf{Bob publishes }(n, e)\textsf{ and keeps }d

3 Two keys solve the key-sharing problem

Symmetric

  • One shared secret key
  • Fast
  • The key must be shared first

Public-key

  • Public key + private key
  • Slower
  • Nothing secret is sent

In practice: public-key to share a symmetric key

4 RSA with small primes

Bob picks p = 5 and q = 11, and e = 3. Find n, (p − 1)(q − 1) and d. Then encrypt m = 4.

→ d is the number with 3d leaving remainder 1 when divided by 40

n = 5 \times 11 = 55
(p - 1)(q - 1) = 4 \times 10 = 40
3 \times 27 = 81 = 2 \times 40 + 1 \Rightarrow d = 27
c = 4^3 \bmod 55 = 64 \bmod 55 = 9

Public key (55, 3), private key 27; 4 encrypts to 9

5 Quick check

Alice wants to send Bob a secret. She encrypts it with…

  • Bob's private key
  • Her private key
  • Bob's public key
  • No key
Show the answer

Bob's public key

Anyone may use Bob's public key, but only Bob's private key can decrypt the result.

6 What to remember

Public key encrypts, private key decrypts

\textsf{RSA: }n = pq\textsf{, }c = m^e \bmod n
m = c^d \bmod n
\begin{aligned}&\textsf{Safe because factorising huge }n\\ &\textsf{is hard}\end{aligned}

Challenge: Why must p and q be hundreds of digits long in real RSA?

Every slide is built click by click: text, formulas and pictures come in one step at a time, so the class follows the reasoning instead of reading ahead. Graphs with sliders can be dragged live while you present.

Make your own version with AIChange the level, the numbers or the language: type the topic and get a new deck that moves in about 30 seconds. Free, no account needed.

Questions teachers ask

How does RSA encryption work?

Pick primes p and q, let n = pq and choose e with a matching d so that e × d leaves remainder 1 when divided by (p − 1)(q − 1). Anyone encrypts with c = mᵉ mod n; only the holder of d decrypts with m = cᵈ mod n.

Are these slides really free?

Yes. Watch them on this page or present them full screen with no account. Making your own copy to edit is free too.

Can I change the slides before my lesson?

Yes. Press "Make my own copy" and the deck becomes one of your projects in the Tracé editor, where you can change the text, the numbers, the colours or the order of the clicks.

Do they work on a classroom projector or an interactive whiteboard?

Yes. They run in the browser on any laptop, so anything that shows your screen works. Press the right arrow or click to go to the next step.