Unit 1 Ans
Unit 1 Ans
, Nagpur
Department of CE & IT
Computer System Security
UNIT: I
The most widely used private key block cipher, is the Data Encryption Standard
(DES). It was adopted in 1977 by the National Bureau of Standards as Federal Information
Processing Standard 46 (FIPS PUB 46). DES encrypts data in 64-bit blocks using a 56-bit
key. The DES enjoys widespread use. It has also been the subject of much controversy its
security.
DES encryption:
The overall scheme for DES encryption is illustrated in Stallings Figure3.4, which
takes as input 64-bits of data and of key.
The left side shows the basic process for enciphering a 64-bit data block which consists of:
- an initial permutation (IP) which shuffles the 64-bit input block
- 16 rounds of a complex key dependent round function involving substitutions &
permutations
- a final permutation, being the inverse of IP
The right side shows the handling of the 56-bit key and consists of:
- an initial permutation of the key (PC1) which selects 56-bits out of the 64-bits input, in
two 28-bit halves
- 16 stages to generate the 48-bit subkeys using a left circular shift and a permutation of the
two 28-bit halves.
The initial permutation and its inverse are defined by tables, as shown in Stallings
Tables 3.2a and 3.2b, respectively. The tables are to be interpreted as follows. The input to
a table consists of 64 bits numbered left to right from 1 to 64. The 64 entries in the
permutation table contain a permutation of the numbers from 1 to 64. Each entry in the
permutation table indicates the position of a numbered input bit in the output, which also
consists of 64 bits.
Note that the bit numbering for DES reflects IBM mainframe practice, and is the opposite
of what we now mostly use - so be careful! Numbers from Bit 1 (leftmost, most significant)
to bit 32/48/64 etc (rightmost, least significant).
Note that examples are specified using hexadecimal.
Here a 64-bit plaintext value of “675a6967 5e5a6b5a” (written in left & right halves) after
permuting with IP becomes “ffb2194d 004df6fb”.
Detail here the internal structure of the DES round function F, which takes R half &
subkey, and processes them through E, add subkey, S & P.
This follows the classic structure for a feistel cipher.
Note that the s-boxes provide the “confusion” of data and key values, whilst the
permutation P then spreads this as widely as possible, so each S-box output affects as many
S-box inputs in the next round as possible, giving “diffusion”.
DES Round Structure
Figure illustrates the internal structure of the DES round function F. The R input is
first expanded to 48 bits by using expansion table E that defines a permutation plus an
expansion that involves duplication of 16 of the R bits .The resulting 48 bits are XORed
with Ki. This 48-bit result passes through a substitution function comprising 8 S-boxes
which each map 6 input bits to 4 output bits, producing a 32-bit output, which is then
permuted by permutation P.
DES Decryption
As with any Feistel cipher, DES decryption uses the same algorithm as encryption
except that the subkeys are used in reverse order SK16 .. SK1.
If you trace through the DES overview diagram can see how each decryption step
top to bottom with reversed subkeys, undoes the equivalent encryption step moving from
bottom to top.
Strength of DES :-
1. Key Size
2. Analytic Attacks
3. Timing Attacks
Q.2) Encrypt the plaintext “read between the lines” using the keyboard “KNIGHT”.
Plaintext - Ciphertext
RE - PL
AD - BT
BE - TL
TW - AV
EX - LV
EN - FK
TH - DK
EL - FM
IN - GI
ES - MP
Thus, the required ciphertext is PLBTTLAVLVFKDKFMGIMP.
Q.4) Explain different block cipher modes of operations and their limitations.
a. Electronic Codebook (ECB) Mode: The simplest mode of operation is called the
electronic codebook (ECB) mode, in which plaintext is handled one block at a time
and each block of plaintext is encrypted using same key. ECB is used when only
a single block of info needs to be sent (Eg-A session encryption key).
The Encryption & Decryption can be shown as-
Limitations:
message repetitions may show in ciphertext
• if aligned with message block
• particularly with data such graphics
• or with messages that change very little, which become a code-book
analysis problem
weakness is due to the encrypted message blocks being independent
main use is sending a few blocks of data
b. Cipher Block Chaining (CBC) Mode: To overcome the problems of repetitions and
order independence in ECB, want some way of making the ciphertext dependent on
all blocks before it. This is what CBC gives us, by combining the previous
ciphertext block with the current message block before encrypting. To start the
process, use an Initial Value (IV), which is usually well known (often all 0's), or
otherwise is sent, ECB encrypted, just before starting CBC use. CBC mode is
applicable whenever large amounts of data need to be sent securely, provided that all
data is available in advance (eg email, FTP, web etc).
c. Cipher Feedback (CFB) Mode: If the data is only available a bit/byte at a time, then
must use some other approach to encrypt it, so as not to delay the info. Idea here is
to use the block cipher essentially as a pseudo-random number generator and to
combine these "random" bits with the message. XOR is an easily inverted operator
(just XOR with same thing again to undo). Again start with an IV to get things
going,
then use the ciphertext as the next input. As originally defined, idea was to
"consume" as much of the "random" output as needed for each message unit
(bit/byte) before "bumping" bits out of the buffer and re-encrypting. This slows the
encryption down as more encryptions are needed. An alternate way to think of it is
to generate a block of "random" bits, consume them as message bits/bytes arrive,and
when they're used up, only then feed a full block of ciphertext back. This is CFB-64
or CFB-128 mode (depending on the block size of the cipher used). CFB is the usual
choice for quantities of stream oriented data, and for authentication use.
The Encryption & Decryption can be shown as-
Limitations:
appropriate when data arrives in bits/bytes
most common stream mode
limitation is need to stall while do block encryption after every n-bits
note that the block cipher is used in encryption mode at both ends
errors propogate for several blocks after the error
d. Output Feedback (OFB) Mode: The alternative to CFB is OFB. Here the generation
of the "random" bits is independent of the message being encrypted. The advantage
is that firstly, they can be computed in advance, good for bursty traffic, and
secondly,
any bit error only affects a single bit. Thus this is good for noisy links (eg satellite
TV transmissions etc).
e. Counter (CTR) Mode: The Counter (CTR) mode is a variant of OFB, but which
encrypts a counter value (hence name). Although it was proposed many years
before,
it has only recently been standardized for use with AES along with the other existing
4 modes. It is being used with applications in ATM (asynchronous transfer mode)
network security and IPSec (IP security). A counter, equal to the plaintext block size
is used. The only requirement stated in SP 800-38A is that the counter value must be
different for each plaintext block that is encrypted. Typically the counter is
initialized to some value and then incremented by 1 for each subsequent block.
The Encryption & Decryption can be shown as-
Limitations:
efficiency
• can do parallel encryptions in h/w or s/w
• can preprocess in advance of need
• good for bursty high speed links
random access to encrypted data blocks
provable security (good as other modes)
but must ensure never reuse key/counter values, otherwise could break (of
OFB)
• Uses three operations. Each operation is performed on two 16-bit inputs to produce
a single 16-bit output
• Bit-by-bit XOR ( )
• Incombination
IDEA, confusion is achieved by using these three separate operations in
Information security involves protecting information from diverse threats for the
purpose of ensuring continuity of operation, minimizing damages and maximizing results.
Information security can be seen as a means of protecting:
Unconditionally secure:
An encryption scheme is unconditionally secure if the cipher text
generated by the scheme does not contain enough information to determine uniquely
the corresponding plaintext, no matter how much ciphertext is available.
Computationally secure:
An encryption scheme is said to be computationally secure if
either of the foregoing two criteria are met. The rub is that it is very difficult to estimate
the amount of effort required to cryptanalyze ciphertext successfully.
Steganography:
Steganography conceal the existence of the message. A simple form of
steganography is one in which an arrangement of words or letters within an apparently
Innocuous text spells out the real message. For example, the sequence of first letters of
each word of the overall message spells out the hidden message.
Some of the other techniques that have been used are-
• Character marking: Selected letters or printed or typewritten text are overwritten
in pencil. The marks are ordinarily not visible unless the paper is held at an
angle to bright light.
• Invisible ink: A number of substances can be used for writing but leave no
visible trace until heat or some chemical is applied to the paper.
• Pin punctures: small pin punctures on selected letters are ordinarily not visible
unless the paper is held up in front of light.
Q.9) Explain in detail the actual DES algorithm using appropriate diagrams.
The most widely used private key block cipher, is the Data Encryption Standard
(DES). It was adopted in 1977 by the National Bureau of Standards as Federal Information
Processing Standard 46 (FIPS PUB 46). DES encrypts data in 64-bit blocks using a 56-bit
key. The DES enjoys widespread use. It has also been the subject of much controversy its
security.
DES encryption:
The overall scheme for DES encryption is illustrated in Stallings Figure3.4, which
takes as input 64-bits of data and of key.
The left side shows the basic process for enciphering a 64-bit data block which consists of:
- an initial permutation (IP) which shuffles the 64-bit input block
- 16 rounds of a complex key dependent round function involving substitutions &
permutations
- a final permutation, being the inverse of IP
The right side shows the handling of the 56-bit key and consists of:
- an initial permutation of the key (PC1) which selects 56-bits out of the 64-bits input, in
two 28-bit halves
- 16 stages to generate the 48-bit subkeys using a left circular shift and a permutation of the
two 28-bit halves.
The initial permutation and its inverse are defined by tables, as shown in Stallings
Tables 3.2a and 3.2b, respectively. The tables are to be interpreted as follows. The input to
a table consists of 64 bits numbered left to right from 1 to 64. The 64 entries in the
permutation table contain a permutation of the numbers from 1 to 64. Each entry in the
permutation table indicates the position of a numbered input bit in the output, which also
consists of 64 bits.
Note that the bit numbering for DES reflects IBM mainframe practice, and is the opposite
of what we now mostly use - so be careful! Numbers from Bit 1 (leftmost, most significant)
to bit 32/48/64 etc (rightmost, least significant).
Note that examples are specified using hexadecimal.
Here a 64-bit plaintext value of “675a6967 5e5a6b5a” (written in left & right halves) after
permuting with IP becomes “ffb2194d 004df6fb”.
Detail here the internal structure of the DES round function F, which takes R half &
subkey, and processes them through E, add subkey, S & P.
This follows the classic structure for a feistel cipher.
Note that the s-boxes provide the “confusion” of data and key values, whilst the
permutation P then spreads this as widely as possible, so each S-box output affects as many
S-box inputs in the next round as possible, giving “diffusion”.
DES Round Structure
Figure illustrates the internal structure of the DES round function F. The R input is
first expanded to 48 bits by using expansion table E that defines a permutation plus an
expansion that involves duplication of 16 of the R bits .The resulting 48 bits are XORed
with Ki. This 48-bit result passes through a substitution function comprising 8 S-boxes
which each map 6 input bits to 4 output bits, producing a 32-bit output, which is then
permuted by permutation P.
DES Decryption
As with any Feistel cipher, DES decryption uses the same algorithm as encryption
except that the subkeys are used in reverse order SK16 .. SK1.
If you trace through the DES overview diagram can see how each decryption step
top to bottom with reversed subkeys, undoes the equivalent encryption step moving from
bottom to top.
Q.14) The Caesar cipher has no real importance where serious security is needed.
Comment.
The Caesar cipher involves replacing each letter of the alphabet with the letter
standing three places further down the alphabet. If it is known that a given
ciphertext is a Caesar cipher, then a brute-force cryptanalysis is easily performed:
Simply try all 25 possible keys.
Three important characteristics of this problem enabled us to use a brute-force
cryptanalysis:
The encryption and decryption algorithm are known.
There are only 25 keys to try.
The language of plaintext is known and easily recognizable.
Thus, the Caesar cipher has no real importance where serious security is needed.
Monoalphabetic cipher
- rather than just shifting the alphabet
-could shuffle (jumble) the letters arbitrarily
-each plaintext letter maps to a different random ciphertext letter
-hence key is 26 letters long
Polyalphabetic ciphers:
-improve security using multiple cipher alphabets
-make cryptanalysis harder with more alphabets to guess and flatter
frequency distribution
-use a key to select which alphabet is used for each letter of the message
-use each alphabet in turn
-repeat from start after end of key is reached
ciphertext :
MEMATRHTGPRYETEFETEOAAT
Key: - COMPUTER
Plaintext: - Please transferonemilliondollarstomyswissbankaccountssixtwotwo
C O M P U T E R
0 1 2 3 4 5 6 7
P L E A S E T R
A N S F E R O N
E M I L L I O N
D O L L A R S T
O M Y S W I S S
B A N K A C C O
U N T S S I X T
W O T W O
Seq.:- 4 3 1 2 5 6 7 0
Output: - SELAWASO AFLLSKSW LNMOMANO ESILYNTT ERIRICI
TOOSSCX RNNTSOT PAEDOBUW
Q.17) Explain the Model of Network Security with access Security Model.
RC5 uses only the following three primitive operations (and their
inverses):
Q.21) What is cryptanalysis? Explain the various types of cryptanalytic attacks based
on the amount of information known to the cryptanalyst.
Cryptanalytic attacks rely on the nature of the algorithm plus perhaps some
knowledge of the general characteristics of the plaintext or even some sample plaintext-
ciphertext pairs.
The various types of Cryptanalytic attacks on security based on the amount of
information known to the cryptanalyst, from least to most. The most difficult problem is
presented when all that is available is the ciphertext only. In some cases, not even the
encryption algorithm is known, but in general we can assume that the opponent does know
the algorithm used for encryption. Then with increasing information have the other attacks.
Generally, an encryption algorithm is designed to withstand a known-plaintext attack.
Various types of cryptanalytic attacks:
f. ciphertext only
1. only know algorithm & ciphertext, is statistical, know or can identify
plaintext
g. known plaintext
1. know/suspect plaintext & ciphertext
h. chosen plaintext
1. select plaintext and obtain ciphertext
i. chosen ciphertext
1. select ciphertext and obtain plaintext
j. chosen text
select plaintext or ciphertext to en/decrypyt
Brute-force attacks try every possible key on a piece of
ciphertext until an intelligible translation into plaintext is obtained. On
average,half of all possible keys must be tried to achieve success.
Plaintext: IAMINSEVENTHSEM
Keyword: EIGHT
(i) By using Playfair cipher encryption method,
Plaintext: IAMINSEVENTHSEM
IA MI NS EV EN TH SE MX
Thus matrix can be constructed as,
E I G H T
A B C D F
K L M N O
P Q R S U
V W X Y Z
Plaintext - Ciphertext
IA - EB
MI - LG
NS - SY
EV - AE
EN - HK
TH - ET
SE - HP
MX - RG
State 1:
C1 C2 C3 C4 C5
i a m i n
s e v e n
t h s e m
State 2:
C1 C2 C3 C4 C5
m v s i s
t a e h i
e e n n m
Q.23) What are block cipher modes of operation of DES? Explain any one mode in
detail.
In ECB decryption, a cipher text block (C1,C2,...,C64) is used directly as the DES input
block (I1,I2,...,164). The input block is then processed through a DES device in the decrypt
state. The resultant output block (O1,O2,...,064) is the plain text (D1,D2,. ..,D64) or may be
used in subsequent ADP applications.
The ECB decryption process is the same as the ECB encryption process except that the
decrypt state of the DES device is used rather than the encrypt state.
Q.24) State the different substitution encryption techniques and explain Caesar
cipher in details and convert plaintext to ciphertext of given sentences.
“Hardwork Makes Man perfect”.
The different substitution encryption techniques are as follows :-
Caesar cipher
Monoalphabetic cipher
Playfair cipher
Hill cipher
Polyalphabetic substitution cipher
Caesar cipher:
The earliest known substitution cipher by Julius Caesar
First attested use in military affairs
The Caesar cipher involves replacing each letter of the
alphabet with the 3rd letter further down the alphabet
example:
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
K , K , …, K 1 j 14
1 2 j
The 18 32-bit subkeys are stored in the P-array:
P , P , …, P
1 2 18
There are 4 S-boxes, each with 8x32(=256) 32-bit entries
S1,0, S1,1, …, S1,255
S2,0, S2,1, …, S2,255
S3,0, S3,1, …, S3,255
S4,0, S4,1, …, S4,255
P-array and then 4 S-boxes are initialized with fractional part of π :
P1= 243F6A8816
P2= 85A308D316
•••
S4,254= 578FDFE316
S4,255= 3AC372E616
Linear Cryptanalysis:
A more recent development is linear cryptanalysis. This attack is based on finding
linear approximations to describe the transformations performed in DES. This method can
find a DES key given 2^43 known plaintexts, as compared to 2^47 chosen plaintexts for
differential cryptanalysis. Although this is a minor improvement, because it may be easier
to acquire known plaintext rather than chosen plaintext, it still leaves linear cryptanalysis
infeasible as an attack on DES. Again, this attack uses structure not seen before. So far,
little work has been done by other groups to validate the linear cryptanalytic approach.
The objective of linear cryptanalysis is to find an effective linear
equation relating some plaintext, ciphertext and key bits that holds with probability p<>0.5
as shown.
P[i1,i2,...,ia] ⊕ C[j1,j2,...,jb] = K[k1,k2,...,kc]
where ia=jb,kc are bit locations in P,C,K
Differential Cryptanalysis:
Biham & Shamir show Differential Cryptanalysis can be successfully used to
cryptanalyse the DES with an effort on the order of 247 encryptions, requiring 247 chosen
plaintexts. They also demonstrated this form of attack on a variety of encryption algorithms
and hash functions.
Differential cryptanalysis was known to the IBM DES design team as early as 1974 (as a T
attack), and influenced the design of the S-boxes and the permutation P to improve its
resistance to it. Compare DES’s security with the cryptanalysis of an eight-round
LUCIFER algorithm which requires only 256 chosen plaintexts, verses an attack on an
eight-round version of DES requires 214 chosen plaintexts.
This attack is known as Differential Cryptanalysis because the analysis
compares differences between two related encryptions, and looks for a known difference
in leading to a known difference out with some (pretty small but still significant)
probability. If a number of such differences are determined, it is feasible to determine the
subkey used in the function f.
Shown here is the equation which shows how this removes the influence of the key, hence
enabling the analysis.
Plaintext: WILLIAMSTALLING
Keyword: INFOTECH
(i) By using Playfair cipher encryption method,
Plaintext: WILLIAMSTALLING
WI LX LI AM ST AL XL IN GX
Thus matrix can be constructed as,
I N F O T
E C H A B
D G K L M
P Q R S U
V W X Y Z
Plaintext - Ciphertext
WI - VI
LX - KY
LI - DO
AM - BL
ST - UO
AL - LS
XL - YK
IN - TI
GX - VK
The possibility of known-plaintext attacks on triple DES with two keys has enticed some
applications to use triple DES with three keys. Triple DES with three keys is used by many
applications such as PGP
C = EK3 (DK2 (EK1 (P)))
No cryptographic significance to middle decrypt operation
backwards compatible with existing single DES (K1 = K2 = K3 )
Two-key Triple DES (K1 = K3 ) or three-key triple DES
Security of Triple DES
no known practical attacks
brute force search impossible
meet-in-the-middle attacks need 256 plaintext-ciphertext pairs per key
A popular current
alternative
Major disadvantage is
speed (3x slower)
Q.30) Explain various types of Cryptanalytic attacks on security.
Cryptanalytic attacks rely on the nature of the algorithm plus perhaps some knowledge
of the general characteristics of the plaintext or even some sample plaintext-ciphertext
pairs.
The various types of Cryptanalytic attacks on security based on the amount of
information known to the cryptanalyst, from least to most. The most difficult problem is
presented when all that is available is the ciphertext only. In some cases, not even the
encryption algorithm is known, but in general we can assume that the opponent does know
the algorithm used for encryption. Then with increasing information have the other attacks.
Generally, an encryption algorithm is designed to withstand a known-plaintext attack.
Various types of cryptanalytic attacks:
k. ciphertext only
1. only know algorithm & ciphertext, is statistical, know or can identify
plaintext
l. known plaintext
1. know/suspect plaintext & ciphertext
m. chosen plaintext
1. select plaintext and obtain ciphertext
n. chosen ciphertext
1. select ciphertext and obtain plaintext
o. chosen text
select plaintext or ciphertext to en/decrypyt
Brute-force attacks try every possible key on a piece of
ciphertext until an intelligible translation into plaintext is obtained. On
average,half of all possible keys must be tried to achieve success.
Monoalphabetic cipher
Plaintext: abcdefghijklmnopqrstuvwxyz
Ciphertext: DKVQFIBJWPESCXHTMYAUOLRGZN
Polyalphabetic ciphers:
improve security using multiple cipher alphabets
make cryptanalysis harder with more alphabets to guess and flatter frequency
distribution
use a key to select which alphabet is used for each letter of the message
use each alphabet in turn
repeat from start after end of key is reached
Q.32) Sort out the difference between substitution technique and transposition
technique with example.
Substitution technique:
Substitution ciphers form the first of the fundamental building blocks. The core
idea is to replace one basic unit (letter/byte) with another.
Examples: Playfair cipher , Caesar cipher ,Hill cipher
Playfair cipher:
Consider ways to reduce the "spikyness" of natural language text, since if
just map one letter always to another, the frequency distribution is just shuffled.
One approach is to encrypt more than one letter at once. The Playfair cipher is an
example of doing this.
The best-known multiple-letter encryption cipher is the Playfair, which
treats digrams in the plaintext as single units and translates these units into
ciphertext digrams. The Playfair algorithm is based on the use of a 5x5 matrix of
letters constructed using a keyword. The rules for filling in this 5x5 matrix are: L to
R, top to bottom, first with keyword after duplicate letters have been removed, and
then with the remain letters, with I/J used as a single letter.
E I G H T
A B C D F
K L M N O
P Q R S U
V W X Y Z
Transposition technique:
. A very different kind of mapping is achieved by performing some sort of
permutation on the plaintext letters. This technique is referred to as a transposition
cipher, and form the second basic building block of ciphers. The core idea is to
rearrange the order of basic units (letters/bytes/bits) without altering their actual
values.
The simplest such cipher is the rail fence technique, in which the
plaintext is written down as a sequence of diagonals and then read off as a sequence
of rows.
The example message is: "meet me after the toga party" with a rail fence of depth 2.
This sort of thing would be trivial to cryptanalyze.