GoalExplain how encryption and one-time codes protect data on the move, and match each threat to a defence.
New words
encryption · scrambling data with a key so that only someone with the right key can read itciphertext · the data after it has been scrambledkey · the secret information used to scramble and unscramble dataone-time code · a code that works only once or for a short time, so a copy of it is useless later
Explanation
You met ciphers in earlier stages: a cipher scrambles a message with a key. Computers use the same idea, called encryption, to protect data on the move. Before the data is sent, it is scrambled with a key into ciphertext, which looks like nonsense. Only the receiver, who has the key, can turn it back. So a sniffer that copies encrypted packets gets only nonsense. To stop replay attacks, many systems add a one-time code, so a copied message is refused when it is sent again. An encrypted connection also checks the website’s digital ID, which makes a man-in-the-middle attack very hard. Real encryption uses huge keys and clever maths, so nobody can break it by trying keys by hand.
MEET AT FIVE→scramble with key 5→RJJY FY KNAJ travels→unscramble with key 5→MEET AT FIVE
Worked examples
Threat
Defence
Why it helps
packet sniffing
encryption
copied packets look like nonsense
replay attack
one-time codes
a copied code has already been used
man in the middle
an encrypted link that checks the website’s ID
the attacker cannot pretend to be the website
The picture above uses a shift code with the key 5: every letter moves five places along the alphabet, so M becomes R. A sniffer on the way sees only RJJY FY KNAJ. Each threat has its own defence.
Time
Message
Code
Door
8:10
open the door
4417
opens
8:12
open the door (a copy)
4417
refuses: code already used
8:30
open the door
9052
opens
A garage door opens with a message from a phone. Each message carries a new code, and the door keeps a list of codes that have been used. A copy sent later is refused.
A shift code is weak, because there are only 25 keys to try. Real encryption has so many keys that even the fastest computers could not try them all.
Class activity
Used-ticket game (no computer): three players are the Sender, the Copier and the Receiver. The Sender writes harmless notes, such as ‘Bring the red ball’, and gives each note a new ticket number from 30 upwards. The Receiver keeps a list of the numbers that have arrived and refuses any number that is already on the list. The Copier secretly copies one note and sends it again later. Does the Receiver catch the copy? Next, the Sender and the Receiver agree a shift key in secret before the game. The Sender scrambles one short note with it. Can the Copier read that note? Talk about which defence stopped which threat, then swap roles.
Practice
1
Encrypt BAG with a shift key of 4. Write the ciphertext.
B becomes F, A becomes E and G becomes K. The ciphertext is FEK.
2
A bike-share lock accepts each code only once. The codes 5120 and 7731 have already been used. Which of the three new messages unlock a bike?
Message
Code
1
8846
2
7731
3
3302
Messages 1 and 3 unlock a bike. Message 2 uses 7731, which has already been used, so it is refused. It may be a replay attack.
3
Why must the key not travel with the message?
Anyone who copies the packets would get the key as well and could decrypt the message. The key must be shared in a safe way.
4
Kenji’s friend says ‘My messages are encrypted, so I can tell my password to anyone.’ What is wrong with this idea?
Encryption only protects data on its way. It cannot help if you give your password away yourself. A password is kept secret and shared only with a parent or carer.