Week 2 · Chapter 3 Information Security: aims and threats, malware, passwords and authentication, tricks that fool people, encryption, digital signatures and secure websites · 3 lessons
3
Secret codes: encryption, signatures and trust
ICT Secondary 1 Term 1, Chapter 3: pp. 24–41
GoalExplain how a key turns a message into a secret, and how a signature shows who sent it.
New words
encryption · turning a readable message into a secret one with a keypublic key / private key · a pair of keys: one locks, the other openshash function · turns any data into a short value of fixed sizedigital signature · proof of who sent a message and that it was not changed
Explanation
Encryption turns plaintext, the readable message, into ciphertext, which looks like nonsense, using a key. Decryption uses a key to turn it back. A simple toy example is a shift code: with a shift of 3, every letter becomes the letter three places later, so CAT becomes FDW. Real codes use mathematics and are far stronger. In symmetric encryption, the same key locks and opens. It is fast, but both people must first share the key in secret, which is the hard part. In public-key encryption each person has two keys. The public key may be given to anyone and is used to lock; only the private key, which the owner keeps secret, opens. No secret needs to travel. It is slower, so computers often use it only to send a fresh symmetric key (a session key) and then work fast with that key. A hash function turns any data into a short value of fixed size; change one letter and the value changes completely, and you cannot rebuild the data from it. A digital signature is the hash of a message locked with the sender’s private key. The receiver opens it with the sender’s public key and compares: if it matches the hash of the message received, the sender is the key’s owner and nothing was changed. A certificate authority vouches that a public key belongs to its owner. A padlock sign on a website means the connection is protected, not that the owner is honest.
plaintext: CAT→lock with a key (shift 3)→ciphertext: FDW→unlock with the key→plaintext: CAT
Worked examples
A toy shift code with shift 3 is shown on the picture. To decode KHOOR, move each letter three places back: K→H, H→E, O→L, O→L, R→O, so the word is HELLO.
Message
Letter numbers
Sum
Toy hash
CAT
3 + 1 + 20
24
24
CAR
3 + 1 + 18
22
22
A toy hash: give each letter its number (A = 1, B = 2, … Z = 26), add the numbers, and keep the last two digits. CAT gives 3 + 1 + 20 = 24 and CAR gives 3 + 1 + 18 = 22. One letter changed, and the value changed. Real hash functions are far better designed, so that nobody can find another message with the same value.
Layla: hash the message→lock the hash with her private key→Youssef: open with her public key→compare with his own hash: equal = genuine
Signing and checking. Layla signs a message: she hashes it and locks the hash with her private key. Youssef receives the message and the locked hash. He opens it with Layla’s public key and also hashes the message he received. If the two values are equal, the message came from Layla’s key and was not changed.
Class activity
With a friend, make a shift code of your own on paper: choose a shift between 1 and 10, write the alphabet and the shifted alphabet in two rows, and send each other a short word. Then say what is hard about sharing the shift number safely.
Practice
1
Decode FDW with a shift of 3.
CAT.
2
In public-key encryption, which key do you give to everyone and which do you keep secret?
You give the public key to everyone and keep the private key secret.
3
What does a digital signature show about a message?
Who sent it (the owner of the key) and that it was not changed.
4
A website shows a padlock. Does this prove that its owner is honest? Explain.