Explore how public and private keys secure digital communication — a paired, hands-on AP Cybersecurity 5.4 activity.
You and a partner will use real cryptography — the same RSA public-key math that protects websites, email, and messaging — to send each other a secret message that only the intended person can read, and to prove who really sent it.
Work through the three steps below. Each of you is on your own device; you'll trade public keys and encrypted messages back and forth, while carefully guarding your private key.
Complete them in order. Both partners do all three.
Create your own key pair. Keep the private key; share the public key with your partner.
Start Step 1 →Lock a message with your partner's public key and sign it with your private key.
Go to Step 2 →Unlock your partner's message with your private key and verify their signature.
Go to Step 3 →This activity makes public-key cryptography concrete. Rather than reading about RSA, students generate live 2048-bit key pairs in the browser, exchange public keys, and send each other a message that is both confidential (encrypted) and authenticated (digitally signed). It is a hands-on companion to the OpenSSL work in Topic 5.4 — the browser's Web Crypto API stands in for openssl genrsa / pkeyutl, letting students see the encryption direction and signature check that the CED asks them to reason about.
Objectives below are aligned to Unit 5, Topic 5.4 (Asymmetric Cryptography). Essential-knowledge statements are paraphrased for brevity — confirm exact wording against your current official CED.
genrsa, rsa -pubout, and pkeyutl -encrypt/-decrypt. This activity mirrors those operations visually in the browser.| Step | Students do | Concept demonstrated | CED link |
|---|---|---|---|
| 1 · Generate | Create a 2048-bit key pair; keep the private key, share the public key. | Keys are born as a pair and are mathematical inverses. The public key can be shared openly; the private key must be protected — the whole security model rests on this asymmetry. | 5.4.A.1–.3, 5.4.B |
| 2 · Encrypt & Sign | Encrypt a message with the partner's public key; sign it with their own private key. | Encryption direction: you lock with the receiver's public key so only they can open it. Signing with your own private key proves authorship and integrity. | 5.4.A.4, 5.4.C.1 |
| 3 · Decrypt & Verify | Decrypt with their own private key; verify the signature with the partner's public key. | Only the matching private key decrypts. Verifying the signature with the sender's public key confirms authenticity — and a tampered or wrongly-signed message fails the check. | 5.4.A.4, 5.4.C.1 |
The learning-objective and essential-knowledge codes above are aligned to the AP Cybersecurity Course and Exam Description (Unit 5: Securing Applications and Data, Topic 5.4). The official College Board CED is the authoritative source — verify exact codes and wording against your current edition. AP and Advanced Placement are trademarks of the College Board, which is not affiliated with and does not endorse this activity.
Think of it like a locked mailbox:
You generate both keys together as a pair. Share your public key freely — but never share your private key.
Click to create a real 2048-bit RSA key pair in your browser.
Your Public Key
Share this with your partner. They will use it to encrypt messages to you.
Your Private Key
Keep your private key handy — you'll paste it in Steps 2 and 3. (If your browser allows, it's remembered automatically for this session.)
Partner's Public Key
Paste the public key your partner shared with you.
Your Private Key
Used to sign the message so your partner knows it's really from you.
Your Secret Message
🔐 Encrypted & Signed Message
Copy this and send it to your partner. Only their private key can decrypt it, and your signature proves it's from you.
Your Private Key
Used to decrypt the message that was locked with your public key.
Partner's Public Key (for verification)
Used to check the signature and confirm the message really came from your partner.
Encrypted Message from Partner
Paste the encrypted message your partner sent you.
📨 Decrypted Message