You are on page 1of 65

The University of Guyana

Faculty of Natural Sciences

LECTURE 3
Computer and Information
Security Fundamentals
(CSE 2203)
SEMESTER II (2021 -2022)

Sandra Khan BSc MSc CISSP PG Dip Education (Higher Ed)


sandra.khan@uog.edu.gy

Department of Computer Science


The University of Guyana
Faculty of Natural Sciences
Before we begin..
GUYANA AT THE OAS,
WASHINGTON DC.
Mr. Christopher Painter,
US Coordinator for Cyber
Security

Department of Computer Science / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Announcements
- Tutorial Groups

- Tutorial 3 Presentations –
next week (5%)

- Assignment 1 (10%)
- Write up due
April 21st, 2022
- BONUS MARKS!!! Up to 5% for
participation in the Online
Tutorial Forum

Department of Computer Science / CSE2203 / 2021-2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Course Outline
Week 1 – Security Basics
Week 2 – Introduction to Cryptography
Week 3 - Authentication, Encryption (DES/RSA), Hashing
Week 4 - Integrity – Digital Certificates, Message Digests
Week 5 – Network and Internet Security
Week 6 - Internet Commerce, SSL, IPSec, Firewalls
Week 7 – VPN / IDS
Week 8 & 9 – Wireless Security
Week 10 – System Security
Week 11 – Access Control
Week 12 – Application Security
Week 13 – Cyber Crime

Department of Computer Science / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Teaching Objectives
Today’s lesson focuses on fundamental principles of
cryptography and fundamental principles of cryptanalysis:

Cryptography – how ciphers are built


Cryptanalysis - how encryption systems are “broken”

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Learning Objectives

By the end of this lesson students will be able to:

● Discuss encryption and cryptanalytic techniques


● Describe the difference between theoretical security and

practical security
● Discuss the methods of substitution and transposition when

building ciphers, their weaknesses and the relevance of


product ciphers
● Discuss Claude Shannon’s principles of designing ciphers,

including confusion and diffusion

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Recap
In the last lecture, we discussed:

● Discuss the role of Cryptography in securing information

● Explain basic Cryptosystems

● Describe Classical Ciphers

Distinguish between two types of Cryptography: Symmetric


and Asymmetric

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Recap Question

For many applications, confidentiality is not the most


important security service. Can you provide some
examples?

(Martin, 2009)

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Recap Quiz

The __________ is the original message before


transformation:

a) ciphertext
b) Secret-text
c) Plaintext
d) None of the above

http://novella.mhhe.com/sites/844815617x/student_view0/chapter30/multiple_choice_quiz.html

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana
Faculty of Natural Sciences
Recap Quiz

In a(n) ______ cipher, the sender and receiver pre-share the


same key:

a) Symmetric-key
b) Asymmetric-key
c) Both a) and b)
d) Neither a) nor b)

http://novella.mhhe.com/sites/844815617x/student_view0/chapter30/multiple_choice_quiz.html

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Lesson Outline
The University of Guyana
Faculty of Natural Sciences

Terminology and Background


1. Threats to Messages
Making “Good” Ciphers
2. Requirements for Crypto Protocols
1. Criteria for “Good” Ciphers
3. Theoretical vs Practical Security
2. Stream and Block Ciphers
4. Cryptanalysis
3. Symmetric and Asymmetric
Basic Types of Ciphers Cryptosystems
1. Representing Characters
2. Substitution Ciphers
1. The Ceasar Cipher
2. Other Substitution Ciphers
3. One-Time Pads
3. Transposition Ciphers
4. Product Ciphers [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Common
The University of Guyana
Faculty of Natural Sciences
Terminology
plaintext - the original message
ciphertext - the coded message
cipher - algorithm for transforming plaintext to ciphertext
key - info used in cipher known only to sender/receiver
encipher (encrypt) - converting plaintext to ciphertext
decipher (decrypt) - recovering ciphertext from plaintext
cryptography - study of encryption principles/methods
cryptanalysis (codebreaking) - the study of principles/ methods
of deciphering ciphertext without knowing key
cryptology - the field of both cryptography and cryptanalysis

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Threats to Messages
The University of Guyana
Faculty of Natural Sciences

Interception
Interruption
• Blocking msgs
Modification
Fabrication
“A threat is blocked by control of a vulnerability”
[Pfleeger & Pfleeger]
[cf. B. Endicott-Popovsky, U. Washington]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Requirements for Security
The University of Guyana
Faculty of Natural Sciences
Protocols
• Messages should get to destination
• Only the recipient should get it
• Only the recipient should see it
• Proof of the sender’s identity
• Message shouldn’t be corrupted in transit
• Message should be sent/received once

• Proofs that message was sent/received (non-repudiation)

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Basic Cryptographic Scheme
The University of Guyana
Faculty of Natural Sciences

ENCRYPTION DECRYPTION original


plaintext ENCODING ciphertext DECODING plaintext
P ENCIPHERING C DECIPHERING P
E D

◼ P = <p1, p2, ..., pn> pi = i-th char of P


◼ P = “DO NOT TELL ANYBODY” p1 = „D”, p2 = „O”, etc.
◼ By convention, cleartext in uppercase
◼ C = <c1, c2, ..., cn> ci = i-th char of C
◼ C = “ep opu ufmm bozcpez” c1 = „e”, c2 = „p”, etc.
◼ By convention, ciphertext in lowercase
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Formal Notation
The University of Guyana
Faculty of Natural Sciences

ENCRYPTION DECRYPTION original


plaintext ciphertext plaintext
ENCODING DECODING
P ENCIPHERING C DECIPHERING P
E D

◼ C = E(P) E – encryption rule/algorithm


◼ P = D(C) D – decryption rule/algorithm

◼ We need a cryptosystem, where:


◼ P = D(C)= D(E(P))
◼ i.e., able to get the original message back

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Benefits of Cryptography
The University of Guyana
Faculty of Natural Sciences

Improvement not a Solution!


• Minimizes problems
• Doesn’t solve them
• Remember: There is no solution! No guarantee of 100% security.

• Adds an envelope (encoding) to an open postcard (cleartext)

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Cryptography in Practice
The University of Guyana
Faculty of Natural Sciences

◼ Sending a secure message


ENCRYPTION
plaintext ENCODING ciphertext hostile
P ENCIPHERING C environment
E
◼ Receiving a secure message

DECRYPTION original
hostile ciphertext DECODING plaintext
environment C DECIPHERING P
[Lilien, 2007]
D
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Keyed Cryptosystem
The University of Guyana
Faculty of Natural Sciences

Encryption Decryption
KE KD
Key Key

P C P
E D

◼ C = E(KE, P)
◼ E = set of encryption algorithms / KE selects Ei  E

◼ P = D(KD, C)
◼ D = set of decryption algorithms / KD selects Dj  D

◼ We need: P = D(KD, E(KE, P))


[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Classification of
The University of Guyana
Faculty of Natural Sciences
Cryptosystems w.r.t. keys
Keyless cryptosystems exist (e.g., Caesar’s cipher - below)
• Less secure
Keyed cryptosystems
• Symmetric cryptosystems: KE = KD
• Classic
• Encipher and decipher using the same key
• Or one key is easily derived from other

• Asymmetric cryptosystems: KE ≠ KD
• A.k.a. a public key system
• Encipher and decipher using different keys [Lilien, 2007]
• Computationally infeasible to derive one key from other
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Theoretical vs Practical
The University of Guyana
Faculty of Natural Sciences
Security
• Theoretically, it is possible to devise
unbreakable cryptosystems
• Based on Shannon’s theory of information
• Practical cryptosystems almost always are
breakable, given adequate time and computing
power
• The trick is to make breaking a cryptosystem
hard enough for the intruder
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Theoretical vs Practical
The University of Guyana
Faculty of Natural Sciences
Security
Example: Breakability of an encryption algorithm
Consider a message with just 25 characters
▪ 2625 possible decryptions ~ 1035 decryptions
▪ Only one is the right one
▪ Brute force approach to find the right one:
▪ At 1010 (10 bln) decr./sec => 1035 / 1010 = 1025 sec = 10 bln yrs !
▪ Infeasible with current technology

Be smarter – use ingenuity


• Could reduce 2625 to, say, 1015 decryptions to check
At 1010 decr./sec => 1015 / 1010 = 105 sec = ~ 1 day [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Cryptanalysis – breaking
The University of Guyana
Faculty of Natural Sciences
Ciphers
Information used for cryptanalysts:
• Intercepted encrypted msgs
• Known encryption algorithms
• Intercepted plaintext
• Data known or suspected to be ciphertext
• Math or statistical tools and techniques
• Properties of natural languages
• Esp. adversary’s natural language
• To confuse the Japanese cryptanalysts, Americans used Navajo language in WW2
• Propertiers of computer systems
Role of ingenuity / luck
There are no rules!!!
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Cryptanalysis
The University of Guyana
Faculty of Natural Sciences

Cryptanalysts goals:
• Break a single msg
• Recognize patterns in encrypted msgs, to be able to break the
subsequent ones
• Infer meaning w/o breaking encryption
• Unusual volume of msgs between enemy troops may indicate a coming attack
• Busiest node may be enemy headquarters
• Deduce the key, to facilitate breaking subsequent msgs
• Find vulnerabilities in implementation or environment of an
encryption algorithm
• Find a general weakness in an encryption algorithm [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Cryptanalysis Scenarios
The University of Guyana
Faculty of Natural Sciences

Cryptanalyst approaches
1)Ciphertext-only attack
• All that the cryptanalyst has is ciphertext
• See cryptanalysis of Caesar’s cipher, columnar transposition cipher

2)Known plaintext attack


• Cryptanalyst has C and P
• Needs to deduce E such that C=E(P), then finds D

3)Probable plaintext attack


• Partial decryption provides partial match to C [Lilien, 2007]
• This provides more clues
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Cryptanalysis Scenarios
The University of Guyana
Faculty of Natural Sciences

Cryptanalyst approaches
4)Chosen plaintext attack
• Analyst able to fabricate encrypted msgs
• Then observe effects of msgs on adversary’s actions
• This provides further hints

5)Chosen ciphertext attack


• Analyst has both E and C
• Run E for many candidate plaintexts to find P for which E(P) =
C
• Purpose: to find KE
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Representing characters
The University of Guyana
Faculty of Natural Sciences

Letters (uppercase only) represented by numbers 0-25 (modulo


26).
A B C D ... X Y Z
0 1 2 3 ... 23 24 25

Operations on letters:
A + 2 = C
X + 4 = B(circular!)
[Lilien, 2007]
...
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Basic Types of Ciphers
The University of Guyana
Faculty of Natural Sciences

Substitution ciphers
• Letters of P replaced with other letters by E

Transposition (permutation) ciphers


• Order of letters in P rearranged by E

Product ciphers
• E = ” E1 “+” E2 “+” ... “+” En
• Combine two or more ciphers to enhance the security of the
cryptosystem
[Lilien, 2007]
...
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Substitution Ciphers
The University of Guyana
Faculty of Natural Sciences

Substitution ciphers:
• Letters of P replaced with other letters by E

Outline ( Ciphers & Weaknesses):


a. The Caesar Cipher

b. Other Substitution Ciphers

c. One-Time Pads [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The Caesar Cipher
The University of Guyana
Faculty of Natural Sciences

▪ci=E(pi)=pi+3 mod 26 (26 letters in the English alphabet)

Change each letter to the third letter following it


(circularly)
A → D, B → E, ... X → A, Y → B, Z → C

▪Can represent as a permutation : (i) = i+3 mod 26


(0)=3, (1)=4, ...,
(23)=26 mod 26=0, (24)=1, (25)=2

▪Key = 3, or key = ‘D’ (bec. D represents 3) [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The Caesar Cipher
The University of Guyana
Faculty of Natural Sciences

▪Example [cf. B. Endicott-Popovsky]

▪ P (plaintext): HELLO WORLD


▪ C (ciphertext): khoor zruog

▪Caesar Cipher is a monoalphabetic substitution


cipher (= simple substitution cipher)

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Attacking a Substitution
The University of Guyana
Faculty of Natural Sciences
Cipher
▪Exhaustive search
▪ If the key space is small enough, try all possible keys until you
find the right one
▪ Cæsar cipher has 26 possible keys
from A to Z OR: from 0 to 25

▪Statistical analysis (attack)


▪ Compare to so called 1-gram (unigram) model of English
▪ It shows frequency of (single) characters in English

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Unigrams for English
The University of Guyana
Faculty of Natural Sciences

a 0.080 h 0.060 n 0.070 t 0.090


b 0.015 i 0.065 o 0.080 u 0.030
c 0.030 j 0.005 p 0.020 v 0.010
d 0.040 k 0.005 q 0.002 w 0.015
e 0.130 l 0.035 r 0.065 x 0.005
f 0.020 m 0.030 s 0.060 y 0.020
g 0.015 z 0.002
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Statistical Attack
The University of Guyana
Faculty of Natural Sciences

▪Compute frequency f(c) of each letter c in


ciphertext
▪Example: c = ‘khoor zruog’
▪10 characters: 3 * ‘o’, 2 * ‘r’, 1 * {k, h, z, u, g}
▪f(c):
f(g)=0.1 f(h)=0.1 f(k)=0.1 f(o)=0.3 f(r)=
0.2
f(u)=0.1 f(z)=0.1 f(ci) = 0 for any other ci

▪Apply 1-gram model of English


▪Frequency of (single) characters in English
[Lilien, 2007]
▪1-grams on previous slide
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Statistical Attack
The University of Guyana
Faculty of Natural Sciences
▪(i) - correlation of frequency of letters in ciphertext with
frequency of corresponding letters in English —for key i
▪For key i: (i) = 0 ≤ c ≤ 25 f(c) * p(c – i)
▪c representation of character (a-0, ..., z-25)
▪f(c) is frequency of letter c in ciphertext C
▪p(x) is frequency of character x in English
▪Intuition: sum of probabilities for words in P, if i were the key
▪Example: C = ‘khoor zruog’ (P = ‘HELLO WORLD’)
f(c): f(g)=0.1, f(h)=0.1, f(k)=0.1, f(o)=0.3, f(r)=0.2, f(u)=0.1, f(z)=0.1
c: g - 6, h - 7, k - 10, o - 14, r - 17, u - 20, z – 25
(i) = 0.1p(6 – i) + 0.1p(7 – i) + 0.1p(10 – i) +
+ 0.3p(14 – i) + 0.2p(17 – i) + 0.1p(20 – i) +
+ 0.1p(25 – i) [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Problem with Caesar Cipher
The University of Guyana
Faculty of Natural Sciences

▪Conclusion: Key is too short


▪1-char key – monoalphabetic substitution
▪Can be found by exhaustive search
▪Statistical frequencies not concealed well by short key
▪They look too much like ‘regular’ English letters

▪Solution: Make the key longer


▪n-char key (n  2) – polyalphabetic substitution
▪Makes exhaustive search much more difficult
▪Statistical frequencies concealed much better
▪Makes cryptanalysis harder
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Other Substitution Ciphers
The University of Guyana
Faculty of Natural Sciences

n-char key

Polyalphabetic substitution ciphers

Vigenere Tableaux cipher

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Polyalphabetic Substitution
The University of Guyana
Faculty of Natural Sciences

◼ Flatten (diffuse) somewhat the frequency distribution


of letters by combining high and low distributions
◼ Example – 2-key substitution:
A B C D E F G H I J K L M
Key1: a d g j m p s v y b e h k
Key2: n s x c h m r w b g l q v
N O P Q R S T U V W X Y Z
Key1: n q t w z c f i l o r u x
Key2: a f k p u z e j o t y d i
◼ Question:
[Lilien, 2007]
How Key1 and Key2 were defined?
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Polyalphabetic Substitution
The University of Guyana
Faculty of Natural Sciences

...
Example:
A B C D E F G H I J K L M
Key1: a d g j m p s v y b e h k
Key2: n s x c h m r w b g l q v
N O P Q R S T U V W X Y Z
Key1: n q t w z c f i l o r u x
Key2: a f k p u z e j o t y d i

◼ Answer:
Key1 – start with ‘a’, skip 2, take next, skip 2, take next letter, ... (circular)
Key2 - start with ‘n’ (2nd half of alphabet), skip 4, take next, skip 4,
take next, ... (circular) [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Polyalphabetic Substitution
The University of Guyana
Faculty of Natural Sciences
Example:
A B C D E F G H I J K L M
Key1: a d g j m p s v y b e h k
Key2: n s x c h m r w b g l q v
N O P Q R S T U V W X Y Z
Key1: n q t w z c f i l o r u x
Key2: a f k p u z e j o t y d i
Plaintext: TOUGH STUFF
Ciphertext: ffirv zfjpm
use n (=2) keys in turn for consecutive P chars in P
Note:
Different chars mapped into the same one: T, O → f
Same char mapped into different ones: F → p, m [Lilien, 2007]
‘f’ most frequent in C (0.30); in English: f(f) = 0.02 << f(e) = 0.13
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
Note: Row A – shift 0 (a->a)
Row B – shift 1 (a->b)
Vigenere Tableaux (1) Row
...
C – shift 2 (a->c)
[cf. J. Leiwo, VU, NL] Row Z – shift 25 (a->z)
◼ P
Vigenere Cipher
The University of Guyana
Faculty of Natural Sciences

◼ Example
Key:
EXODUS
Plaintext P:
YELLOW SUBMARINE FROM YELLOW RIVER
Extended keyword (re-applied to mimic words in P):
YELLOW SUBMARINE FROM YELLOW RIVER
EXODUS EXODUSEXO DUSE XODUSE XODUS
Ciphertext:
cbxoio wlppujmks ilgq vsofhb owyyj
▪ Question: How derived from the keyword and
the Vigenère tableaux? [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Vigenere Cipher
The University of Guyana
Faculty of Natural Sciences

◼ Example
...
Extended keyword (re-applied to mimic words in P):
YELLOW SUBMARINE FROM YELLOW RIVER
EXODUS EXODUSEXO DUSE XODUSE XODUS
Ciphertext:
cbxoio wlppujmks ilgq vsofhb owyyj
▪ Answer:
c from P indexes row
c from extended key indexes column
e.g.: row Y and column e → ‘c’
row E and column x → ‘b’
row L and column o → ‘z’
... [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


One-time Pads
The University of Guyana
Faculty of Natural Sciences

◼ OTP (One-Time Pad) – a variant of Vigenère Tableaux


◼ Fixes problem with VT: key used might be too short
◼ Above: ‘EXODUS’ – 6 chars

◼ Sometimes considered a perfect cipher


◼ Used extensively during Cold War

◼ One-Time Pad:
◼ Large, nonrepeating set of long keys on pad sheets/pages
◼ Sender and receiver have identical pads

◼ Example:
◼ 300-char msg to send, 20-char key per sheet
[Lilien, 2007]
=> use & tear off 300/20 = 15 pages from the pad
LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan
One-time Pads
The University of Guyana
Faculty of Natural Sciences
◼ Example – cont.:
▪ Encryption:
▪ Sender writes letters of consecutive 20-char keys above the
letters of P (from the pad 15 pages)
▪ Sender enciphers P using Vigenère Tableaux (or other pre-
arranged chart)
▪ Sender destroys used keys/sheets
▪ Decryption:
▪ Receiver uses Vigenère Tableaux
▪ Receiver uses the same set of consecutive 20-char keys
from the same 15 consecutive pages of the pad
▪ Receiver destroys used keys/sheets [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


One-time Pads
The University of Guyana
Faculty of Natural Sciences

◼ Note:
◼ Effect: a key as long as the message
◼ If only key length ≤ the number of chars in the pad
◼ The key is always changing (and destroyed after use)
◼ Weaknesses
◼ Perfect synchronization required between S and R
◼ Intercepted or dropped messages can destroy synchro

◼ Need lots of keys


◼ Needs to distribute pads securely
◼ No problem to generate keys

◼ Problem: printing, distribution, storing, accounting


◼ Frequency distribution not flat enough
◼ Non-flat distribution facilitates breaking [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Examples of One-time Pads
The University of Guyana
Faculty of Natural Sciences

◼ Vernam Cipher
◼ = (lttr + random nr) mod 26
◼ Need (pseudo) random nr generator
◼ E.g., V = 21; (V +76) mod 26 = 97 mod 26 = 19; 19 = t

◼ Book Ciphers
◼ Book used as a pad
◼ need not destroy – just don’t reuse keys
◼ Use common Vigenère Tableaux
◼ Details: textbook
◼ Incl. example of breaking a book cipher
◼ Bec. distribution not flat [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The Vernam Cipher
The University of Guyana
Faculty of Natural Sciences

Developed by Gilbert Vernam for AT&T


Is immune to most cryptanalytic attacks
Uses long non-repeating sequence of numbers that
are combined with the plaintext
Used long punched paper tape that fed into a
teletype machine
Tape contained random numbers that were
combined with characters typed into the teletype
sequence of random numbers had no repeats, and
each tape was used only once
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The Vernam Cipher
The University of Guyana
Faculty of Natural Sciences

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Transposition Ciphers
The University of Guyana
Faculty of Natural Sciences

▪ Rearrange letters in plaintext to produce ciphertext


▪ Example 1a and 1b: Columnar transposition
▪ Plaintext: HELLO WORLD
▪ Transposition onto: (a) 3 columns: (b) onto 2 columns:
HEL HE
LOW LL
ORL
OW
DXX XX - padding
OR
▪ Ciphertext (read column-by column): LD
(a) hlodeorxlwlx
(b) hloolelwrd

▪ What is the key?


▪ Number of columns: (a) key = 3 and (b) key = 2 [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Transposition Ciphers
The University of Guyana
Faculty of Natural Sciences

▪ Example 2: Rail-Fence Cipher


▪ Plaintext: HELLO WORLD
▪ Transposition into 2 rows (rails) column-by-column:
HLOOL
ELWRD
▪ Ciphertext: hloolelwrd

▪ What is the key?


▪ Number of rails key = 2
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Attacking Transposition
The University of Guyana
Faculty of Natural Sciences
Ciphers
▪ Anagramming
▪ n-gram – n-char strings in English
▪ Digrams (2-grams) for English alphabet are are: aa, ab, ac, ...az, ba, bb,
bc, ..., zz (262 rows in digram table)
▪ Trigrams are: aaa, aab, ... (263 rows)
▪ 4-grams (quadgrams?) are: aaaa, aaab, ... (264 rows)

▪ Attack procedure:
▪ If 1-gram frequencies in C match their freq’s in English but other n-gram freq’s
in C do not match their freq’s in English, then it is probably a transposition
encryption
▪ Find n-grams with the highest frequencies in C
▪ Start with n=2
▪ Rearrange substrings in C to form n-grams with highest freq’s
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Attacking Transposition
The University of Guyana
Faculty of Natural Sciences
Ciphers
Ciphertext C: hloolelwrd (from Rail-Fence cipher)
▪ N-gram frequency check
▪ 1-gram frequencies in C do match their frequencies in English
▪ 2-gram (hl, lo, oo, ...) frequencies in C do not match their frequencies in English
▪ Question: How frequency of „hl” in C is calculated?
▪ 3-gram (hlo, loo, ool, ...) frequencies in C do not match their frequencies in
English
▪ ...
=> it is probably a transposition
▪ Frequencies in English for all 2-grams from C starting with h
▪ he 0.0305
▪ ho 0.0043 as table of freq’s of
▪ hl, hw, hr, hd < 0.0010 English diagrams
shows
▪ Implies that in hloolelwrd e follows h
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Attacking Transposition
The University of Guyana
Faculty of Natural Sciences
Ciphers
▪ Arrange so the h and e are adjacent
Since 2-gram suggests a solution, cut C into 2 substrings –
the 2nd substring starting with e:
hlool elwrd
Put them in 2 columns:
he
ll
ow
or
ld
▪ Read row by row, to get original P: HELLO WORLD
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Product Ciphers
The University of Guyana
Faculty of Natural Sciences

◼ A.k.a. combination ciphers


◼ Built of multiple blocks, each is:
◼ Substitution
or:
◼ Transposition

◼ Example: two-block product cipher


◼ E2(E1(P, KE1), KE2)

◼ Product cipher might not be stronger than its individual components


used separately!
◼ Might not be even as strong as individual components
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Making Good Ciphers
The University of Guyana
Faculty of Natural Sciences

Criteria for good ciphers:


◼ “Good” depends on intended application

◼ Substitution
◼ C hides chars of P
◼ If > 1 key, C dissipates high frequency chars

◼ Transposition
◼ C scrambles text => hides n-grams for n > 1

◼ Product ciphers
◼ Can do all of the above

◼ What is more important for your app?


What facilities available to sender/receiver?
◼ E.g., no supercomputer support on the battlefield
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Making Good Ciphers
The University of Guyana
Faculty of Natural Sciences

◼ Claude Shannon’s criteria (1949):


1. Needed degree of secrecy should determine amount of labor
◼ How long does the data need to stay secret?

(cf. Principle of Adequate Protection)

2. Set of keys and enciphering algorithm should be free from


complexity
◼ Can choose any keys or any plaintext for given E

◼ E not too complex (cf. Principle of Effectiveness)

3. Implementation should be as simple as possible


◼ Complexity => errors (cf. Principle of Effectiveness)[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Making Good Ciphers
The University of Guyana
Faculty of Natural Sciences

◼ Shannon’s criteria (1949) – cont.


4. Propagation of errors should be limited
◼ Errors happen => their effects should be limited

◼ One error should not invlidate the whole C


(None of the 4 Principles — Missing? — Invent a new Principle?)

5. Size / storage of C should be restricted


◼ Size (C) should not be > size (P)

◼ More text is more data for cryptanalysts to work with

◼ Need more space for storage, more time to send

(cf. Principle of Effectiveness)

◼ Proposed at the dawn of computer era –


still valid! [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Criteria for Good Ciphers
The University of Guyana
Faculty of Natural Sciences

◼ Characteristics of good encryption schemes


◼ Confusion:
interceptor cannot predict what will happen to C when she
changes one char in P
◼ E with good confusion:

hides well relationship between P”+”K, and C


◼ Diffusion:
changes in P spread out over many parts of C
◼ Good diffusion => attacker needs access to much of C

to infer E [Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Lesson Summary
The University of Guyana
Faculty of Natural Sciences

Diffusion (Transposition)
• Order of the letters is rearranged
• Basis for some widely used commercial-grade encryption algorithms
• Goal - widely spread the information from the message or the key
across the ciphertext (diffusion)
• Also known as permutation (rearrangement of symbols of a message)
Confusion (Substitution)
• As against, diffusion which can be achieved
through using transpositional techniques.
Block ciphers rely on confusion as well as diffusion
while stream cipher only uses confusion.
[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


Lesson Summary
The University of Guyana
Faculty of Natural Sciences

Properties of Trustworthy Encryption Systems /


Ciphers:
It is based on sound mathematics
It has been analyzed by competent experts and
found to be sound
It has stood the test of time

[Lilien, 2007]

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


The University of Guyana FURTHER INFORMATION
Faculty of Natural Sciences

Course notes and references are available via Moodle.

Required Readings:

Pfleeger, C. P., & Pfleeger, S. L. (2015). Security in


computing: Chapters 2 & 12

Department of Computer Science


The University of Guyana
Faculty of Natural Sciences
Readings
Required Reading(s)

Pfleeger, C. P., & Pfleeger, S. L. (2015). Security in


computing. Prentice Hall Professional Technical Reference.

Stallings, W. (2006). Cryptography and Network Security, 4/E.


Pearson Education India.

Recommended Reading(s)
Stallings, W. (2007). Network security essentials: applications
and standards. Pearson Education India.

https://www.sans.org/security-resources/glossary-of-terms/
Department of Computer Science / CSE2203 / 2022 / Lecturer: Sandra Khan
The University of Guyana REFERENCES
Faculty of Natural Sciences

Martin,K.(2009). Intro to Cryptography [PowerPoint


Presentation]. Retrieved from Royal Holloway ISG

Pfleeger, C. P., & Pfleeger, S. L. (2015). Security in


computing. Prentice Hall Professional Technical Reference.
Lilien, L. (2007). Introduction to Cryptology (Section 3, Ch. 2. P1).
Department of Computer Science, Western Michigan University
https://techdifferences.com/difference-between-confusion-and-
diffusion.html

LECTURE 3 / CSE2203 / 2022 / Lecturer: Sandra Khan


End of Lecture 3

You might also like