Network Security Lec 2
Network Security Lec 2
(Lec 2)
“Introduction to Key concepts in
Cryptography”
2
Cryptography
Secure writing
Mostly based on mathematics
Applications include security of
ATM cards
Computer passwords
Electronic commerce
3
Goals of Cryptography
Authentication
Confidentiality
Integrity
Non-Repudiation
4
Conventional Encryption Principles
IS-876 5
Cryptographic System
Secure Communication
Confidentiality
Authentication
Message Integrity
6
Plaintext, Encryption, Ciphertext, and
Decryption
Encryption Note:
Key Interceptor Cannot Read
Ciphertext Without the
Decryption Key
Plaintext Encryption Ciphertext “11011101”
“Hello” Method &
Key Interceptor
Network
Decryption
Key
Party B
7
Key Length and Number of Possible
Keys
Key Length
Number of Possible Keys
in Bits
1 2
2 4
4 16
8 256
16 65,536
40 1,099,511,627,776
56 72,057,594,037,927,900
112 5,192,296,858,534,830,000,000,000,000,000,000
8
Figure 7-3: Key Length and Number of
Possible Keys
Key Length
Number of Possible Keys
in Bits
112 5.1923E+33
168 3.74144E+50
256 1.15792E+77
512 1.3408E+154
9
Symmetric Key Encryption for
Confidentiality
Symmetric Note:
Key A single key is used to
encrypt and decrypt
in both directions.
Plaintext Encryption Ciphertext “11011101”
“Hello” Method &
Key Interceptor
Network Same
Symmetric
Key
Party B
10
Public Key Encryption for
Confidentiality
Encrypted
Encrypt with Decrypt with
Message
Party B’s Public Key Party B’s Private Key
Party A Party B
Decrypt with Encrypt with
Party A’s Private Key Encrypted Party A’s Public Key
Message
11
More Definitions
unconditional security
no matter how much computer power or time is
available, the cipher cannot be broken since the
ciphertext provides insufficient information to
uniquely determine the corresponding plaintext
computational security
given limited computing resources , the cipher
cannot be broken
IS-876 12
Symmetric Cipher Model
Requirements for secure use of
encryption
Need a strong encryption algo.
Algo should be such that the opponent who knows
the algo and has access to one or more cipher-text,
would unable to decipher or discover the key.
Sender and receiver must exchange the key in
the secure manner.
Continues…
It is impractical to decrypt a message on the
bases of cipher test + knowledge of the algo.
Algo do not need to be secret, need to keep only
key secret.
Wide use of symmetric ciphers ….
Model of Conventional
Cryptosystem
Source produces message in plaintext
X=[X1,X2,X3…..XM].
Key K=[K1,K2,K3…..KJ].
If the key generated at the source , must also
be provided to the destination.
Alternatively , a third party can provide.
Y=E(K,Y)
Model of Conventional
Cryptosystem
Cryptosystem three independent
Dimensions
Type of operations used for transforming plaintext to
ciphertext.
Substitution
Transposition
Product system
Fundamental requirement (no information is lost, all
operations should be reversible)
The number of keys used.
The way in which plaintext is processed.
Block ciphers
Stream ciphers
Cryptanalysis
Attacking ciphers
Two approaches for attacking
Cryptanalysis
Try to exploit the characteristics of the algo
Brute-force attack
Try all options
Substitution techniques
A substitution technique is one in which the
letters of plaintext are replaced by other letters
or by numbers or symbols.
ROT-13 cipher
• The ROT-13 cipher was commonly used to hide the meaning of messages on the
Internet (particularly on Usenet and E-mail).
• Each letter in the plaintext is substituted with the ciphertext letter according to the
following mapping:
p : ABCDEFGHIJKLMNOPQRSTUVWXYZ
F(p) : NOPQRSTUVWXYZABCDEFGHIJKLM
• Example:
– Plaintext: THIS IS A SECRET
– Ciphertext: GUVF VF N FRPERG
• The ROT-13 cipher is an involution (i.e., self-inverse) so that encoding twice will result in
the original message.
• p: ABCDEFGHIJKLMNOPQRSTUVWXYZ
• F(p) : DEFGHIJKLMNOPQRSTUVWXYZABC
• Plaintext: ET TU BRUTUS
• Ciphertext:HW WX EUXWXV
Caesar cipher
• The cipher used by Julius Caesar can be generalized to a function defined
by a parameter k representing the number of letters that we “shift” each
plaintext letter:
c = Fk(p) = p + k (mod 26)
• Out of these 26, only 25 values of k are valid keys (since k=0 has no
effect on the plaintext)
• Example:
– p: ABCDEFGHIJKLMNOPQRSTUVWXYZ
– Fk(p) : QWERTYUIOPASDFGHJKLZXCVBNM
• Both the sender and receiver secretly share the key, representing the
plaintext-ciphertext letter mapping, which is also called the
substitution alphabet.
Cracking the simple substitution cipher
• In 850 CE, Arab/Iraqi scientist Abu Yusuf Yaqub ibn Ishaq al-Kindi published his
book “Risalah fi Istikhraj al-Mu’amma” (A Manuscript on Deciphering
Cryptographic Messages), which contains the first ever published description of
how to crack simple substitution ciphers
• This is particularly true for long messages (i.e., the longer the text, the closer
the letter frequency distributions match the language’s letter frequency
distributions)
• The attacker takes a frequency count of the ciphertext letters and tries to
match them to the letter frequency distribution profile of the plaintext
language
English language:
Relative letter frequencies
Letter A B C D E F G H I J K L M
Frequency 7.4 1.0 3.1 4.2 13.0 2.8 1.6 3.4 7.4 0.2 0.3 3.6 2.5
Letter N O P Q R S T U V W X Y Z
Frequency 7.9 8.0 2.7 0.3 8.0 6.1 9.2 2.6 1.5 1.6 0.5 1.9 0.1
Example: Frequency analysis
• Ciphertext:
R jrk hbxiu lk vai vzihova ohlls lo rk rmrsvjikv
ywbhtbkn. Ixise jlskbkn ai vrgiu vai ihixrvls
tlzk vl vai hlyye rkt hirxiu vai ywbhtbkn. Bk
vai ixikbkn, ai nivu bkvl vai ihixrvls, rkt, bo
vaisi bu uljilki ihui bk vai ihixrvls -- ls bo
bv zru srbkbkn varv tre -- ai nliu yrpg vl abu
ohlls tbsipvhe. Alzixis, bo vaisi bu klylte ihui
bk vai ihixrvls rkt bv aruk'v srbkit, ai nliu vl
vai vikva ohlls rkt zrhgu wm vzl ohbnavu lo
uvrbsu vl abu sllj.
• Letter frequency count (total = 344 letters):
Letter A B C D E F G H I J K L M
Frequency 23 26 0 0 5 0 3 18 49 5 26 32 2
Letter N O P Q R S T U V W X Y Z
Frequency 9 10 2 0 24 19 11 19 37 3 9 6 6
Relative frequency distributions
(English & ciphertext)
Example: Frequency analysis
• From the frequency distributions, we assume that:
– The ciphertext letter I corresponds to the plaintext letter E (the most
frequent letter in the English language)
– The ciphertext letter V corresponds to the plaintext letter T (the second
most frequent letter in the English language)
• Partially decrypted ciphertext (red = plaintext):
R jrk hbxeu lk vae vzehova ohlls lo rk rmrsvjekv
ywbhtbkn. Exese jlskbkn ae vrgeu vae ehexrvls
tlzk vl vae hlyye rkt herxeu vae ywbhtbkn. Bk
vae exekbkn, ae nevu bkvl vae ehexrvls, rkt, bo
vaese bu uljelke ehue bk vae ehexrvls -- ls bo
bv zru srbkbkn varv tre -- ae nleu yrpg vl abu
ohlls tbsepvhe. Alzexes, bo vaese bu klylte ehue
bk vae ehexrvls rkt bv aruk'v srbket, ae nleu vl
vae vekva ohlls rkt zrhgu wm vzl ohbnavu lo
uvrbsu vl abu sllj.
Example: Frequency analysis
• From the frequency distributions, we assume that:
– The ciphertext letter I corresponds to the plaintext letter E (the most
frequent letter in the English language)
– The ciphertext letter V corresponds to the plaintext letter T (the second
most frequent letter in the English language)
• Partially decrypted ciphertext (red = plaintext):
R jrk hbxeu lk tae tzehota ohlls lo rk rmrsvjekt
ywbhtbkn. Exese jlskbkn ae trgeu tae ehexrtls
tlzk tl tae hlyye rkt herxeu tae ywbhtbkn. Bk
tae exekbkn, ae nevu bktl tae ehexrtls, rkt, bo
taese bu uljelke ehue bk tae ehexrtls -- ls bo
bt zru srbkbkn tart tre -- ae nleu yrpg tl abu
ohlls tbsepthe. Alzexes, bo taese bu klylte ehue
bk tae ehexrvls rkt bt aruk't srbket, ae nleu tl
tae tekta ohlls rkt zrhgu wm tzl ohbnatu lo
utrbsu tl abu sllj.
Example: Frequency analysis
• We can assume that the ciphertext letter A corresponds to the
plaintext letter H because:
– The digram ‘TH’ is the most common in the English language
– The word “THE” is the only frequently used 3-letter English word starting
with T and ending with E
• Partially decrypted ciphertext (red = plaintext):
R jrk hbxeu lk the tzehoth ohlls lo rk rmrsvjekt
ywbhtbkn. Exese jlskbkn he trgeu the ehexrtls
tlzk tl the hlyye rkt herxeu the ywbhtbkn. Bk
the exekbkn, he nevu bktl the ehexrtls, rkt, bo
these bu uljelke ehue bk the ehexrtls -- ls bo
bt zru srbkbkn thrt tre -- he nleu yrpg tl hbu
ohlls tbsepthe. Hlzexes, bo taese bu klylte ehue
bk the ehexrtls rkt bt hruk't srbket, he nleu tl
the tekth ohlls rkt zrhgu wm tzl ohbnatu lo
utrbsu tl hbu sllj.
Example: Frequency analysis
• We can assume that the ciphertext letter R corresponds to the
plaintext letter A because:
– The word “THAT” is the only frequently used 4-letter English word starting
with ‘TH’ and ending with T
– The relative frequency of R in the ciphertext closely approximates the
relative frequency of A in English
• Partially decrypted ciphertext (red = plaintext):
A jak hbxeu lk the tzehoth ohlls lo ak amasvjekt
ywbhtbkn. Exese jlskbkn he tageu the ehexatls
tlzk tl the hlyye akt heaxeu the ywbhtbkn. Bk
the exekbkn, he nevu bktl the ehexatls, akt, bo
these bu uljelke ehue bk the ehexatls -- ls bo
bt zau sabkbkn that tae -- he nleu yapg tl hbu
ohlls tbsepthe. Hlzexes, bo taese bu klylte ehue
bk the ehexatls akt bt hauk't sabket, he nleu tl
the tekth ohlls akt zahgu wm tzl ohbnatu lo
utabsu tl hbu sllj.
Example: Frequency analysis
• We can assume that the ciphertext letter K corresponds to the
plaintext letter N because:
– The words “AN” and “AT” are the only frequently used 2-letter English
words starting with A
– The relative frequency of K in the ciphertext closely approximates the
relative frequency of N in English
• Partially decrypted ciphertext (red = plaintext):
A jan hbxeu ln the tzehoth ohlls lo an amasvjent
ywbhtbnn. Exese jlsnbnn he tageu the ehexatls
tlzn tl the hlyye ant heaxeu the ywbhtbnn. Bn
the exenbnn, he nevu bntl the ehexatls, ant, bo
these bu uljelne ehue bn the ehexatls -- ls bo
bt zau sabnbnn that tae -- he nleu yapg tl hbu
ohlls tbsepthe. Hlzexes, bo taese bu nlylte ehue
bn the ehexatls ant bt haun't sabnet, he nleu tl
the tekth ohlls ant zahgu wm tzl ohbnatu lo
utabsu tl hbu sllj.
Example: Frequency analysis
• We assume that:
– The ciphertext letter T corresponds to the plaintext letter D (from the word
‘ant’)
– The ciphertext letter B corresponds to the plaintext letter I (from the
words ‘bt’ and ‘bn’)
• Trigram frequencies
– Common trigrams: THE, ING, THA, ENT