Chapter 3 Final
Chapter 3 Final
Security Techniques
Information Security
(SE3052)
3
Terminologies
Plain text:
Is the original intelligible message or data that is fed into the algorithm as input.
The plaintext is not quite the same as the message being sent.
The message probably has to be translated into some standard form to be encrypted; for
example, this might be leaving out the punctuation, turning it into ASCII code or a
sequence of numbers, etc.
But there is nothing secret about this stage; knowing the plaintext is equivalent to knowing
the message.
Cipher text:- is the scramble message produced as an output of the encryption algorithm.
Key(Secret Key):
Is some critical information used by the encryption algorithm as input to encrypt the
plaintext.
It is independent of the plaintext and encryption algorithm
5
Basic approaches to Information Security
Workstations are attached to LANs so that users can reach other hosts, workstations and servers
in the same LAN that are interconnected via bridges and routers.
Since data is transmitted in the form packets (visible on the LAN) which contain
source/destination IDs, and other information, an eavesdropper can have access to this
information.
An eavesdropper may also occur in any of the communications links which provide connectivity
to the system.
Link Encryption:
Each vulnerable communication link is equipped on both ends with an encryption device.
User information, header, trailers, source/destination addresses and routing data will be encrypted
The only data/information that will not be encrypted is data link control message infn
The main disadvantage is that it is effective only if all potential weak links from source to
destination are secured.
7
Characteristics of Cryptographic Systems
The number of keys used:-
If both sender and receiver use the same key, the system is referred to as symmetric,
single-key or conventional encryption.
If the sender and receiver use different keys, then the system is referred to as
Asymmetric, two-key or public-key encryption.
The way in which the plain text is processed:- Input plain text can be processed either
using block cipher or stream cipher.
A block cipher processes the input one block of elements(typically 64 or 128 bits) at
a time, producing an output block for each input block.
A stream cipher processes the input elements (one bit or one byte) continuously,
producing output one element at a time, as it goes along.
8
Requirements for Secure use of Conventional Encryption
Strong Encryption algorithm:- The algorithm should be strong enough so that an opponent
who knows the algorithm and has access to one or more cipher text would be unable to
decipher the cipher text or figure out the key.
Sender and receiver must have obtained copies of the secret key in a secure fashion and
must keep the key secure.
If someone can discover the key and knows the algorithm, all communication using
the key is readable.
Therefore, if the key is generated at the message source, then it must be provided to
the destination by means of some secure channel.
Alternatively, a third party could generate the key and securely deliver it to both
source and destination.
9
Attacking Symmetric Encryption
cryptanalysis
rely on nature of the algorithm
plus some knowledge of plaintext characteristics
even some sample plain text - cipher text pairs
exploits characteristics of algorithm to deduce specific plaintext or key
Objective:- to recover the plaintext of a cipher text or, more typically, to recover the
secret key.
Kerkhoff’s principle:- the adversary knows all details about a cryptosystem except the
secret key.
brute-force attack
try all possible keys on cipher text until get an intelligible translation into plaintext
On average, half of all possible keys must be tried to achieve success.
10
Cryptanalytic Attack
May be classified by how much information needed by the attacker:
Cipher text-only attack
Known-plaintext attack
Chosen-plaintext attack
Chosen-cipher text attack
Chosen-text attack
Cipher text-only attack
Attacker knows cipher text of several messages encrypted with same key
Possible to recover plaintext (also possible to deduce key) by looking at frequency of
cipher text letters
That is, Given: a cipher text c and the question is, what is the plaintext m?
An encryption scheme is completely insecure if it cannot resist cipher text-only attacks.
The easiest to defend against because the opponent has the least amount information to
11
work with
Cryptanalytic Attack
Known-plaintext attack
The attacker knows the Algorithm, cipher text and plaintext-cipher text pair
Attackers observe pairs of plaintext-cipher text encrypted with the same secret key.
Possible to deduce key and/or devise algorithm to decrypt cipher text.
That is, Given: (m1,c1), (m2,c2), …, (mk, ck) and a new cipher text c
Q: what is the plaintext c and what is the secret key in use?
Chosen-plaintext attack
Attacker can choose the plaintext and look at the paired cipher text
Attacker has more control than known-plaintext attack and may be able to gain more
information about key
That is, Given: (m1,c1), (m2,c2), …,(mk,ck), where m1, m2, …, mk are chosen by the
adversary; and a new cipher text c.
Q: what is the plaintext c, or what is the secret key?
12
The attacker knows the Algorithm, cipher text and chosen plaintext and its cipher text
Cryptanalytic Attack
Chosen-cipher text attack
Attacker chooses a series of plaintexts, basing the next plaintext on the result of
previous encryption
The Encryption algorithm, cipher text and purported cipher text chosen by
cryptanalyst, together with its corresponding decrypted plaintext generated with the
secret key are known to cryptanalyst.
That is, Given: (m1,c1), (m2,c2), …,(mk, ck), where c1, c2, …, ck are chosen by the
adversary; and a new cipher text c.
Q: what is the plaintext of c, or what is the secret key?
The attacker knows the Algorithm, cipher text & chosen plaintext and its cipher text
Example:-
13
Cryptanalytic Attack
Chosen-text attack
Here the attacker has the capability to choose arbitrary plaintexts to be encrypted and
obtain the corresponding cipher texts.
The attacker knows the Algorithm, cipher text, chosen plaintext and chooen cipher text
The goal of the attack is to gain some further information which reduces the security of
the encryption scheme.
In the worst case, a chosen-plaintext attack could reveal the scheme's secret key.
The Encryption algorithm, cipher text, plaintext message chosen by the cryptanalyst,
together with its corresponding cipher text generated with the secret key and purported
cipher text chosen by cryptanalyst, together with its corresponding decrypted plaintext
generated with the secret key are known to cryptanalyst.
Two forms of Chosen-text attack
Batch chosen-plaintext attack
14
Adaptive chosen-plaintext attack
Transposition Cipher
Rearrange letters in plaintext to produce cipher text
For example, if we have 3 "rails" and a message of ‘KILL THE QUEEN', the cipher
writes out: K . . . T . . . U . . .
. I . L . H . Q . E . N
. . L . . . E . . . E .
15
2. Route Cipher
In a route cipher, the plaintext is first written out in a grid of given dimensions, then read
off in a pattern given in the key.
In fact, for messages of reasonable length, the number of possible keys is potentially too
great to be enumerated even by modern machinery.
Example, if we have 3 "rails" and a message,‘KILL THE QUEEN', the cipher writes out:
The key might specify "spiral inwards, clockwise, starting from the top right".
K L E E
I T Q E
L H U N
16
3. Columnar transposition
The message is written out in rows of a fixed length, and then read out again column by
column, and the columns are chosen in some scrambled order.
Both the width and the permutation of the columns are usually defined by a keyword.
For example, the word ZEBRAS is of length 6 (so the columns are of length 6), and the
permutation is defined by the alphabetical order of the letters in the keyword. In this case,
the order would be "6 3 2 4 1 5".
In a regular columnar transposition cipher, any spare spaces are filled with nulls; in an
irregular columnar transposition cipher, the spaces are left blank
Providing five nulls (QKJEU) at the end.
Example: WE ARE DISCOVERED FLEE AT ONCE The text is then read off as: cipher
6 3 2 4 1 5 6 3 2 4 1 5 EVLNE ACDTK ESEAQ ROFOJ
W E A R E D W E A R E D DEECU WIREE
I S C O V E I S C O V E
R E D F L E R E D F L E In the irregular case, the columns are not
E A T O N C E A T O N C completed by nulls.The cipher text is
17 then read off as EVLNA CDTES
E Q K J E N E
EAROF ODEEC WIREE
4. Double transposition
A single columnar transposition could be attacked by guessing possible column lengths,
writing the message out in its columns (but in the wrong order, as the key is not yet
known), and then looking for possible anagrams.
Thus to make it stronger, a double transposition was often used. This is simply a columnar
transposition applied twice.
The same key can be used for both transpositions, or two different keys can be used.
As an example, we can take the result of the irregular columnar transposition in the
previous section, and perform a second encryption with a different keyword, STRIPE,
which gives the permutation "564231":
18
5. MyszkowskiTransposition
A variant form of columnar transposition, proposed by Émile Victor Théodore
Myszkowski in 1902, requires a keyword with recurrent letters.
In usual practice, subsequent occurrences of a keyword letter are treated as if the next
letter in alphabetical order, e.g., the keyword TOMATO yields a numeric keystring of
"532164."
19
6. Disrupted Transposition
In disrupted transposition, certain positions in a grid are blanked out, and not used when
This breaks up regular patterns and makes the cryptanalyst’s job more difficult.
[Reading Assignment]
20
Substitution Cipher
A substitution technique is one in which the letters of plaintext are replaced by other letters
or by numbers or symbols.
If the plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext
Polyalphabetic cipher
Vigenère cipher
Plaintext characters are substituted by a different alphabet stream of characters shifted to the
E.g.,ABCDEFGHIJKLMNOPQRSTUVWXYZ
DEFGHIJKLMNOPQRSTUVWXYZABC
22
ADDITIVE CIPHER
This cipher is sometimes called a shift cipher or Caesar cipher, but the term additive
For this reason, additive ciphers are sometimes referred to as the Caesar cipher. Caesar
23
Contd.
When the cipher is additive, the plaintext, cipher text, and key are integers in Z26.
Example: Use the additive cipher with key = 15 to encrypt the message “hello”.
Use the additive cipher with key = 15 to decrypt the message “WTAAD”?
24
Brute-force cryptanalysis attack
If it is known that a given cipher text is a Caesar cipher, then a brute-force cryptanalysis is
What generally makes brute-force cryptanalysis impractical is the use of an algorithm that
employs a large number of keys and if the language of the plain text is unknown.
Example: Eve has intercepted the cipher text “PHHW PH DIWHU WKH WRJD
SDUWB”. Show how she can use a brute-force attack to break the cipher.
Solution: Eve tries keys from 1 to 25. With a key of 3, the plaintext is “meet me after toga
26
Multiplicative Ciphers
In a multiplicative cipher, the plaintext and cipher text are integers in Z26; the key is an
integer in Z26*.
Solution: The key needs to be in Z26*. This set has only 12 members: 1, 3, 5, 7, 9, 11,
Use a multiplicative cipher to encrypt the message “hello” with a key of 7. The cipher
text is “XCZZU”.
27
Affine Ciphers
Example: Use affine cipher to encrypt the message “hello” with the key (7, 2).
Example: Use affine cipher to decrypt the message “ZEBBW” with the key pair
(7, 2) in modulus 26.
28
Monoalphabetic Substitution Cipher
With only 25 keys, the Caesar cipher is far from secure. A dramatic increase in the key space
can be achieved by allowing an arbitrary substitution.
In general, there are n! permutations of a set of n elements, because the first element can be
chosen in one of n ways, the second in n -1 ways, the third in n-2 ways, and so on.
29
Contd.
The additive cipher is a special case of an affine cipher in which
Because additive, multiplicative, and affine ciphers have small key domains, they are very
A better solution is to create a mapping between each plaintext character and the
Alice and Bob can agree on a table showing the mapping for each character.
Cryptanalysts are helped by the fact that they have to see what character would correspond
In polyalphabetic cipher, each plaintext character may be replaced by more than one
character
substitute.
The relationship between a character in the plaintext to a character in the cipher text is
one-to-many.
31
Vigenère cipher
Is the most commonly used polyalphabetic cipher method.
Vigenère cipher starts with a 26 x 26 matrix of alphabets in sequence. First row starts with
It requires a keyword that the sender and receiver know ahead of time
Each character of the message is combined with the characters of the keyword to find the
Refer the Vigenère table here (Refer at the end of the slides)
Example: Given a Message = SEE ME IN MALL and a keyword as INFOSEC, then the
Vigenère cipher uses the fact that the keyword character helps to get different cipher text
To decrypt, the receiver places the keyword characters below each cipher text character
Using the table, choose the row corresponding to the keyword character and look for the
Example: A R J A W M P U N Q Z
I N F O S E C I N F O
--------------------------
S E E M E I N M A L L
33
Contd.
Vigenere cipher can be seen as combinations of m additive ciphers.
Keyword is taken as the first few words of a book that is agreed upon by sender and receiver
34 Everything else works like the Vigenère cipher [Reading Assignment]
Hill Cipher
Is a polyalphabetic cipher invented by Lester S. Hill.
Unlike the other polyalphabetic ciphers we studied so far, the plaintext is divided into
The blocks are encrypted one at a time in a such away that each character in the block
Is a block cipher but the others we studied so far belongs to the stream cipher
category.
In Hill cipher, the key is a square matrix of size mx m in which m is the size of the block.
Let the key be K, each element of the matrix is Kij as shown below.
35
Contd.
The substitution is determined by m linear equations in which each character is assigned a
C2 = (k21P1 + k22P2 + k23P3) mod 26 C=KP mod 26
C3 = (k31P1 + k32P2 + k33P3) mod 26 17 17 5
21 18 21
Example:- Given a plaintext = PAY MORE MONEY and the encryption key:
2 2 19
Solution: The first three letters of the plaintext are represented as
The text for the entire plaintext is LNS HDL EWM TRW
Decryption requires using inverse of the matrix K. The Inverse K-1 of a matrix K is defined
C = E(K,P) = KP mod 26
P = D(C,K) = K-1C mod 26 = K-1KP
Note
2. Although Hill cipher is strong against a cipher text-only attack, it is easily broken with a
known plaintext attack.
37
Multiple Letter Cipher
Keyword “Infosec”
Play fair cipher is a multiple letter cipher
Alphabets that are not in the keyword are arranged in the remaining cells from left to right
4. Plaintext letters in the same row are row corresponding to the column of the
38 replaced by letters to the right (cyclic manner) other letter and vice versa
Contd.
Example:- Plaintext: “CRYPTO IS TOO EASY”
Keyword is “INFOSEC”
To decrypt, the receiver reconstructs the 5 x 5 matrix using the keyword and then uses the
39
Vernam Cipher
One of the goals of cryptography is perfect secrecy. A study by Shannon has shown that
perfect secrecy can be achieved if each plaintext symbol is encrypted with a key
Randomly chosen from a key domain. This idea is used in a cipher called one-time pad,
invented by Vernam.
U.S. Army Major Joseph Mauborgne and AT&T’s Gilbert Vernam developed a cipher in 1917
Uses a one time arrangement of a key string that is as long as the plaintext
Key is used only once but characters in key may not be distinct
Its purpose is to provide a standard method for protecting sensitive commercial and
unclassified data.
In May 1973, and again in Aug 1974 the NBS (now NIST) called for possible encryption
Response was mostly disappointing, however, IBM submitted their Lucifer design
Following a period of redesign and comment it became the Data Encryption Standard
The DES algorithm is a careful and complex combination of two fundamental building blocks
odd parity bit is added to each block (i.e., a "0" or "1" is added to the block so that there are
an odd number of 1 bits in each 8-bit block).
By using the 8 parity bits for rudimentary error detection, a DES key is actually 64 bits in
length for computational purposes (although it only has 56 bits worth of randomness, or
entropy).
DES is a symmetric-key block cipher published by the National Institute of Standards and
Technology (NIST).
42
DES Structure
The encryption process is made of two permutations (P-boxes), which we call initial
Confusion
A technique that seeks to make the relationship between the statistics of the cipher text and
Diffusion
A technique that seeks to obscure the statistical structure of the plaintext by spreading out
the influence of each individual plaintext digit over many cipher text digits.
the place k.
43
Cont...
The key-dependent computation can be simply defined in terms of a function f,
called the cipher function, and a function KS, called the key schedule.
Best: changing one input bit results in changes of approx. half the output bits
Completeness effect
where each output bit is a complex function of all the input bits
44
Feistel Cipher
Invented by Horst Feistel, working at IBMThomas J Watson research labs in early 70's,
The idea is to partition the input block into two halves, l(i-1) and r(i-1), use only r(i-1) in
The function f incorporates one stage of the S-P network, controlled by part of the key k(i)
45
Contd.
46
Fig. General structure of DES
DES Basics
DES uses the two basic techniques of cryptography - confusion and
diffusion.
47
DES - The 16 Rounds
The output of the last (sixteenth) round consists of 64-bit text that are
functions of the input plaintext and the key.
The right half goes through one DES round, and the result becomes the
The old left half becomes the new right half, and will go through one
This goes on for 16 rounds, but after the last round the left and right
halves are not swapped, so that the result of the 16th round becomes the
final right half, and the result of the 15th round (which became the left
half of the 16th round) is the final left half.
50
Contd.
51
Initial Permutation Vs. Inverse (Final) Permutation Tables
The Initial permutation and its inverse are defined by tables.
Bit 0 1 2 3 4 5 6 7 Bit 0 1 2 3 4 5 6 7
1 58 50 42 34 26 18 10 2 1 40 8 48 16 56 24 64 32
9 60 52 44 36 28 20 12 4 9 39 7 47 15 55 23 63 31
17 62 54 46 38 30 22 14 6 17 38 6 46 14 54 22 62 30
25 64 56 48 40 32 24 16 8 25 37 5 45 13 53 21 61 29
33 57 49 41 33 25 17 9 1 33 36 4 44 12 52 20 60 28
41 59 51 43 35 27 19 11 3 41 35 3 43 11 51 19 59 27
49 61 53 45 37 29 21 13 5 49 34 2 42 10 50 18 58 26
57 63 55 47 39 31 23 15 7 57 33 1 41 9 49 17 57 25
9 13 30 6 22 11 4 25
Expansion
53
Substitution Boxes (S-Box)
F
The first and last bits of the input to Si form a 2-bit binary number to
select one of the four substitutions defined by a the four rows in the table
[1]
54 for Si.
Contd.
The middle four bits select one of the 16 columns.
The decimal value in the cell selected by the row and column is then
Example: In S1, for input 011001, the row is 01(row 1) and the
[1]
56
DES Key Generation
The key is first subjected to permutation governed by a table labeled as
and D0.
At each round, Ci-1 and Di-1 are separately subjected to a circular left shift,
The shifted values serve as input to the next round. They also serve as input
57
Permutation Tables
57 49 41 33 25 17 9 14 17 11 24 1 5 3 28
1 58 50 42 34 26 18 15 6 21 10 23 19 12 4
10 2 59 51 43 35 27 26 8 16 7 27 20 13 2
19 11 3 60 52 44 36 41 52 31 37 47 55 30 40
51 45 33 48 44 49 39 56
63 55 47 39 31 23 15
34 53 46 42 50 36 29 32
7 62 54 47 38 30 22
Permutation table PC-2
14 6 61 53 45 37 29
21 13 5 28 20 12 4 DES – Example:
Permutation table PC-1 Given Key (K) = 581FBC94D3A452EA AND
Plaintext (P) = 3570E2F1BA4682C7 Encryption
Using a one-round version of DES algorithm
58
Double and Triple DES
The simplest form of double DES encryption has two encryption stages and two keys.
Given a plaintext p and two encryption keys k1 and k2 and , cipher text C is generated as :
C=EK2 (E K1(p))
Decryption requires that the keys be applied in reverse order: P=DK1 (DK2 (C))
For Double DES, this scheme apparently involves a key length of 562 bits, resulting in a
The double DES encryption only doubles the work for the attacker.
59
Contd.
60
Fig. Double and Triple DES encryption and Decryption
Meet-in-the-Middle Attack on Double DES
Double-DES: C = EK2(EK1(P))
61
Triple DES
Also referred as EDE (Encryption Decryption Encryption)
Using two keys and applying them in three operations adds apparent strength.
Triple DES procedure is C=EK1 (DK2 (EK1(p))), that is, you encrypt with one key, decrypt
with the second key and encrypt with the first key again.
Although this process is called Triple DES, because of the three applications of the DES
But a 112-bit effective key length is quite strong and it is effective against all feasible known
attacks.
practice: C = EK1(DK2(EK1(P)))
If K1=K2, then 3DES = 1DES. Thus, a 3DES software can be used as a single-DES.
Encryption: C = EK3(DK2(EK1(P)))
So, 3DES with 3keys is backward compatible with 3DES with 2 keys and with the
regular DES
Requirements: block length of 128 bits, key lengths of 128, 192, and 256 bits.
AES was adopted for use by the US government in December 2001 and be came the Federal
Rijndael allows various block lengths. But AES allows only one block size: 128 bits.
64
Overview of Rijndael Algorithm
It is a fast algorithm that can be implemented easily on simple processes.
Like DES, AES uses repeated cycles. That is , there are 9, 11 or 13 cycles for keys of 128, 192,
65
Contd.
2. Shift Rows (transposition step):- for 128 and 192-bit block size, row n is shifted
left circular (n-1) bytes: for 256-bit blocks, row 2 is shifted 1 byte and rows 3 and 4 are
shifted 3 and 4 bytes respectively.
3. Mix Columns:- this step involves shifting left and exclusive-ORing bits with
themselves.
4. Add Sub keys:- Here, a portion of the key unique to this cycle is exclusive-O Red
with the cycle result.
66
Comparison of DES and AES
DES AES
Date 1976 1999
67
Private Vs. Public-Key Cryptography
Traditional private/secret/single key cryptography uses one key shared by
Hence does not protect sender from receiver forging a message & claiming is
sent by sender
But public-key cryptography uses two keys – a public & a private key
The two keys operate as inverse, one key undoes the encryption provided by the other.
A user can encrypt a message with a public key and the message can be revealed only with
A user can encrypt a message with a private key and the message can be revealed only with
Public-Key algorithms rely on two keys with the characteristics that it is:
1. Computationally infeasible to find decryption key knowing only algorithm & encryption key
2. Computationally easy to en/decrypt messages when the relevant (en/decrypt) key is known
3. either of the two related keys can be used for encryption, with the other used for decryption
70
Public-Key Cryptosystems
71
Some algorithms are suitable for all uses, others are specific to one
Security of Public Key Schemes
More generally the hard problem is known, its just made too hard to do
in practise
72
Comparing Secret-key and Public-key Encryption
Secret key Public key
(Symmetric) (Asymmetric)
Number of Keys One Two
Protection of key Must be kept secret One key must be kept secret: the
other can be freely exposed.
73
RSA Encryption
RSA cryptosystems, named after its inventors R. Rivest, S. Shamir and A.
It may be used to provide both secrecy and digital signatures and its
modulo a prime
The two keys used in RSA, d and e, are used for decryption & encryption.
but, having chosen one, you must keep the other one private.
P=E(D(P))=D(E(P))
note ø(N)=(p-1)(q-1)
other
77
RSA Use
to encrypt a message M the sender:
note that the message M must be smaller than the modulus N (block if
needed)
78
RSA Example
1. Select primes: p=17 & q=11
2. Compute n = pq =17×11=187
3. Compute ø(n)=(p–1)(q-1)=16×10=160
5. Determine d: de=1 mod 160 and d < 160 Value is d=23 since 23×7=161= 10×160+1
79
RSA Security
Three approaches to attacking RSA:
Compare and contrast: Substitution and Transposition, Stream and Block and Symmetric
and Asymmetric encryption algorithms.
Try to perform decryption mechanisms for all types of encryptions and apply
cryptanalysis techniques to breach confidentiality of information.
Good luck!
80