Encrypt and Sign with Two Keys
About this app
Alice, Bob and Eve with their key rings: padlocks for the public keys (everybody has all of them), keys for the private ones (only with their owner). Bob chooses what to encrypt DIES_IST_EIN_GEHEIMTEXT with, the digit card travels over the line, Eve tries every padlock. With Bob's private key Eve reads along – that is a signature, not a secret. In signed mode Alice signs an order via SHA-256, Bob checks it, Eve changes 500 to 5000 or guesses. Plus RSA with 3713 = 47 · 79 and factoring.
Two keys, two jobs
In asymmetric cryptography everyone has a key pair. The public key works like a padlock anyone can have; the private key opens it and stays with its owner. To send a secret message you lock it with the recipient’s public key. To sign something you use your own private key, and anyone can verify the signature with the public key. Signing keeps nothing secret; it proves origin and integrity. RSA’s security rests on the fact that factoring large numbers into primes is practically infeasible.
What the app shows
Alice, Bob and Eve each have a key ring: padlocks for the public keys (everyone has all of them) and keys for the private ones (only the owner). In confidential mode Bob chooses what to encrypt DIES_IST_EIN_GEHEIMTEXT with; the digit card travels over the line, Eve listens in and tries every lock. In signed mode Alice signs an order via its SHA-256 hash, Bob verifies, and Eve changes 500 to 5000 or guesses a signature. The calculations use RSA with the modulus 3713 = 47 · 79.
Try it yourself
Deliberately make the wrong choice: if Bob encrypts with his own private key, Eve can read along, because everyone has his public lock. That is a signature, not a secret. In signing mode you see that an altered order fails verification. In the RSA panel Eve can factor 3713 into 47 · 79 and so recompute the private key. With today’s typical 3072-bit numbers this is not feasible in reasonable time with known methods.
Frequently asked questions
- What is the difference between encrypting and signing?
- To encrypt you use the recipient’s public key, so only she can read it with her private key. To sign you use your own private key, and anyone can check with the public key that the message is genuine and unchanged. Encryption protects content, signing protects origin.
- How does RSA work in simple terms?
- Choose two primes p and q and form n = p·q. From p and q compute a public exponent e and a private exponent d. Encrypt with c = mᵉ mod n and decrypt with m = cᵈ mod n. Anyone who can factor n into p and q can compute d.
- Why is RSA secure?
- Its security relies on there being no known efficient method to factor large numbers into primes. With 3072-bit keys this is practically infeasible on today’s computers. Small numbers like 3713, by contrast, factor instantly.
- What can I try in the app?
- In two modes you choose which key encrypts or signs and see what Eve achieves on the line. In the RSA panel you calculate with 3713 = 47 · 79 and let Eve factor the number.
Subject: Cryptography
More from Cryptography
- The Nonce Lottery
- Hashing & collisions
- Pseudorandomness — how a computer rolls dice
- SHA-256 in slow motion (8-bit model)
- Cracking a Substitution Cipher
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps