Cryptography and Network Security
Cryptography and Network Security
MODULE I
1. INTRODUCTION
Security basics
The following describe the general threats to the security of the distributed systems
Disclosure of information
o Organizations maintain valuable information on their computer systems. This
information may be used by other parties in such a way as to damage the interest
of the organization owning the information. Therefore information stored on or
processed by computer systems must be protected against disclosure both internal
and external to the user organization.
Contamination of information
o Valuable information may become worthless if unauthorized information is mixed
with it. The damage may be as great as the damage through information
disclosure.
Unauthorized use of resources
o Unauthorized use of resources may lead to destruction, modification, loss of
integrity etc. of resources and thus the authorization of individual users will be
limited.
Misuse of resources
o Authorized use of resources may give authorized individuals the opportunity to
perform activities that are harmful to the organization. Misuse of resources,
intentional or accidental, may be harmful to the organization through corruption,
destruction, disclosure, loss or removal of resources. Such misuse may affect the
liability of an organization for information entrusted to it or for transactions and
information exchanged with other organizations.
Unauthorized information flow
o In a distributed system, information flow must be controlled not only between
users of end-systems but also between end-systems. Depending on the prevailing
security policy information flow restrictions may be applied to the basis of
classification of data objects and end-systems, user clearances, etc.
Repudiation of information flow
o Repudiation of information flow involves denial of transmission or receipt of
messages. Since such messages may carry purchasing agreement, instructions for
payment etc., the scope for criminal repudiation of such messages is considerable.
Denial of service
o Because of the wide range of services performed with the aid of computer
systems, denial of service may significantly affect the capability of a user
organisation to perform its functions and to fulfill its obligations. Detection and
prevention of denial of service must be considered as part of any security policy.
ITU-T Recommendation X.800, Security Architecture for OSI defines systematic way
to
• Define the requirements for security
• Characterizing the approaches to satisfying those requirements
ITU-T – international Telecommunication Union Telecommunication Standardization
Sector
OSI – Open Systems Interconnections
The OSI security architecture focuses on:
• Security attack: Any actions that compromises the security of information owned by
an organization (or a person)
• Security service: a service that enhances the security of the data processing systems
and the information transfers of an organization. The services make use of one or more
security mechanisms to provide the service
Any action that compromises security of information is called a security attack. Some of the
common security attacks are given below.
• Passive attack: aims to learn or make use of information from the system but does not
affect system resources.
Passive Attacks
goal to obtain information
No modification of content or fabrication
Eavesdropping to learn contents or other information (transfer patterns, traffic
flows etc.)
Two types
Traffic analysis
Release of message contents:
contents of the messages are released against our wish to someone else.
Traffic Analysis :
Active Attacks
Four types
Replay :
User Captures a sequence of events or some data units and resends them
Alteration :
DOS :
Security service is a service which ensures adequate security of the systems or of data transfers
Authentication
Access control
Data confidentiality
Data integrity
Nonrepudiation
1. Authentication
Corroboration of the identity of an entity. Two specific authentication services are
defined in the standard.
Peer Entity Authentication: -
Used in association with a logical connection to provide confidence in the identity
of the entities connected.
Data Origin Authentication: -
In connection less transfer, provides assurance that the source of received data is
as claimed.
2. Access control
In the context of network security, access control is the ability to limit and control
the access to host system and application via communication links. To achieve this, each
entity trying to gain access must first be identified, or authenticated, so that access rights
can be tailored to the individual.
3. Data confidentiality
4. Data integrity
The assurance that data received is exactly as sent by an authorized entity. That
means no modification insertion, deletion or replay. There are five types of specific
services.
Connection Integrity With Recovery: -
Provides for the integrity of all user data on a connection and detects any
modification, insertion, deletion or reply-of any data within an entries data
sequence, with recovery attempted.
Connection Integrity Without Recovery: -
As above, but provides only detection without recovery.
Selective-Field Connection Integrity: -
Provides for the integrity of selected fields within the user data of a data block
transferred over a connection and takes the form of determination of whether the
selected fields have been modified, inserted, deleted or replayed.
Connectionless Integrity: -
Provides for the integrity of a single connectionless data block and may take the
form of detection of data modification. Additionally, a limited form of replay
detection may be provided.
Selective-Field Connectionless Integrity: -
Provides for the integrity of selected fields within a single connectionless data
block; takes the form of determination of a whether the selected field have been
modified.
5. Non-repudiation: -
Provides protection against denial by one of the entities involved in a communication of
having participated in all or part of the communication. There are two types of specific
services in Non-repudiation.
Non-repudiation, origin: -
Proof that the specific parties sent the massage.
Non-repudiation, Destination: -
Proofs that the massage was receive by the specific parties.
Y = EK(X) or Y = E(K, X)
X = DK(Y) or X = D(K, Y)
Y = EK(X)
X = DK(Y)
Cryptanalysis
Objective: to recover the plaintext of a ciphertext or, more typically, to recover the secret
key.
– brute-force attack
Brute-Force Attack
Cryptanalytic Attacks
Known-plaintext attack
Chosen-plaintext attack
Chosen-ciphertext attack
Chosen Text
1. Ciphertext-only attack
Cryptanalysts knows:
Encryption algorithm
Ciphertext
2. Known-plaintext attack
Cryptanalysts knows:
Encryption algorithm
Ciphertext
One or more plaintext-ciphertext pairs formed with the secret key
3. Chosen-plaintext attack
Cryptanalysts knows:
Encryption algorithm
Ciphertext
Plaintext message chosen by cryptanalyst, together with its corresponding
ciphertext generated with the secret key
4. Chosen-ciphertext attack
Cryptanalysts knows:
Encryption algorithm
Ciphertext
Plaintext message chosen by cryptanalyst, together with its corresponding
decrypted plaintext generated with the secret key
5. Chosen Text
Cryptanalysts knows:
Encryption algorithm
Ciphertext
Plaintext message chosen by cryptanalyst, together with its corresponding
decrypted plaintext generated with the secret key
Plaintext message chosen by cryptanalyst, together with its corresponding
ciphertext generated with the secret key
More Definitions
Unconditional security
no matter how much computer power is available, the cipher cannot be broken
since the ciphertext provides insufficient information to uniquely determine the
corresponding plaintext
Computational security
Cost of breaking the cipher exceeds the value of the encrypted information .
The time required to break the cipher exceeds the life time of the information
Classical Ciphers
SUBSTITUTION TECHNIQUES
1. Caesar Cipher
– earliest known substitution cipher
– Invented by Julius Caesar
– Each letter is replaced by the letter three positions further down the alphabet.
– Plain: abcdefghijklmnopqrstuvwxyz
Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
– example:
o meet me after the toga party
o PHHW PH DIWHU WKH WRJD SDUWB
a, b, c, ..., x, y, z
c = EK(p) = (p + k) mod 26
p = DK(c) = (c – k) mod 26
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
– Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
– Now we have a total of 26! = 4 x 1026 keys.
– With so many keys, it is secure against brute-force attacks.
– But not secure against some cryptanalytic attacks.
– Problem is language characteristics.
– Human languages are not random.
– Letters are not equally frequently used.
– In English, E is by far the most common letter, followed by T, R, N, I, O, A, S.
– Other letters like Z, J, K, Q, X are fairly rare.
– There are tables of single, double & triple letter frequencies for various languages
– Key concept: monoalphabetic substitution does not change relative letter
frequencies
– To attack, we
calculate letter frequencies for ciphertext
compare this distribution against the known one
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
count relative letter frequencies (see text)
guess P & Z are e and t
guess ZW is th and hence ZWP is the
proceeding with trial and error finally get:
Plaintext:
it was disclosed yesterday that several informal but direct contacts have been made
with political representatives of the viet cong in Moscow
3. Playfair cipher
– Not even the large number of keys in a monoalphabetic cipher provides
security.
– One approach to improving security was to encrypt multiple letters.
– The Playfair Cipher is an example.
– Invented by Charles Wheatstone in 1854, but named after his friend Baron
Playfair.
Playfair Key Matrix
– A 5X5 matrix of letters based on a keyword
– Fill in letters of keyword.
– Fill rest of matrix with other letters.
– For example, using the keyword MONARCHY
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
2. If both letters fall in the same row, replace each with letter to right
(wrapping back to start from end), e.g., “ar" encrypts as "RM“.
3. If both letters fall in the same column, replace each with the letter
below it (again wrapping to top from bottom), e.g. “mu" encrypts
to "CM“.
Security
– It was widely used for many years in US and British military in WW1.
– It can be broken for a few hundred letters, but still has much of
plaintext structure.
4.Polyalphabetic Ciphers
Vigenère Cipher
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Vernam Cipher
Vernam proposed a bit-wise exclusive or of the message stream with a truly random
zero-one stream which was shared by sender and receipient.
Example:
Plaintext: HELLO(corresponding value- 7 4 11 11 14)
Encryption
PT: H E L L O
7 4 11 11 14
KEY: N C B T A
13 2 1 19 0
XOR ---------------------------
20 6 12 30 14
CT: U G M E O
Decryption
CT: U G M E O
20 6 12 30 14
KEY: N C B T A
13 2 1 19 0
XOR ------------------------------------------------------
7 4 11 -15 14
PT: H E L L O
This cipher is unbreakable in a very strong sense. The intuition is that any message
can be transformed into any cipher (of the same length) by a key, and all
transformations are equally likely.
5. Hill cipher
The Hill cipher uses matrices to transform blocks of plaintext letters into blocks of
ciphertext.
Encryption:
o Assign each letter an index
o C=KP mod 26
o Matrix K is the key
Decryption
o P=inverseof(k) mod 26
Example for hill cipher is added in next file
TRANSPOSITION TECHNIQUES
All techniques examined so far involve the substitution of ciphertext symbol for a
plaintext symbol.
These techniques hide the message by rearranging the letter order without altering the
actual letters.
The ciphertext has the same frequency distribution as the original plaintext.
For encryption:
Depth =2
Write message letters out diagonally over a number of rows, then read off cipher row by
row.
m e m a t r h t g p r y
e t e f e t e o a a t
“MEMATRHTGPRYETEFETEOAAT”
For Decryption:
M E M A T R H T G P R Y
- - - - - - - - - - -
M E M A T R H T G P R Y
E T E F E T E O A A T
For encryption:
A more complex scheme is to write letters of the message in rows over a specified
number of columns.
Then reorder the columns according to some key before reading off the rows.
Key: 3 4 2 1
Plaintext : a t t a
c k t o
d a y X
Ciphertext: AOXTTYACDTKA
(If needed only) If the message is re-encrypted using the same algorithm and the
same key:
Key: 3 4 2 1
Plaintext: a o X t
t y a c
d t k a
Ciphertext: TCAXAKATDOYT
For decryption:
Key: 3 4 2 1
Ciphertext : a t t a
c k t o
d a y X
Plaintext:ATTACKTODAY
STEGANOGRAPHY
Steganography is the practice of concealing a file, message, image, or video within
another file, message, image, or video.
In this method it hides secret behind the message
Various techniques are used:
o Character marking:
Selected letters of 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.
o 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.
o Pin punctures:
Small pin punctures on selected letters are ordinarily not visible unless the
paper is held up in front of a light.
o Typewriter correction ribbon:
Used between lines typed with a black ribbon, the results of typing with
the correction tape are visible only under a strong light.
Advantages:
o It can be employed by parties who have something to lose should the fact of their
secret communication(not necessary the content) be discovered.
Disadvantage:
o It requires a lot of overhead to hide a relatively few bits of information.
o Once the system is discovered it becomes virtually worthless.
ROTOR MACHINES
before modern ciphers, rotor machines were most common complex ciphers in use
widely used in WorldWar2
o German Enigma, Allied Hagelin, Japanese Purple
implemented a very complex, varying substitution cipher
used a series of cylinders, each giving one substitution, which rotated and changed after
each letter was encrypted
with 3 cylinders have 263=17576 alphabets
STREAM CIPHERS
In this scheme, the plaintext is processed one bit at a time i.e. one bit of plaintext is taken,
and a series of operations is performed on it to generate one bit of ciphertext.
Technically, stream ciphers are block ciphers with a block size of one bit.
Eg: Additive cipher, monoalphabetic cipher, vignere cipher
BLOCK CIPHERS
In this scheme, the plain binary text is processed in blocks (groups) of bits at a time; i.e. a
block of plaintext bits is selected, a series of operations is performed on this block to
generate a block of ciphertext bits.
The number of bits in a block is fixed.
For example, the schemes DES and AES have block sizes of 64 and 128, respectively.
Eg: Playfair cipher, Hill cipher
BLOCK CIPHER PRINCIPLES
block size
o increasing size improves security, but slows cipher
key size
o increasing size improves security, makes exhaustive key searching harder, but
may slow cipher
number of rounds
o increasing number improves security, but slows cipher
subkey generation
o greater complexity can make analysis harder, but slows cipher
round function
o greater complexity can make analysis harder, but slows cipher
fast software en/decryption & ease of analysis
are more recent concerns for practical use and testing
To show that the output of the first round of the decryption process is equal to a 32-bit swap of
the input to the sixteenth round of the encryption process.
LE 16 = RE 15
RE 16 = LE 15 x F(RE 15 , K 16 )
LD 1 = RD0= LE 16 = RE 15
RD 1 = LD0 x F(RD0 , K 16 )
= RE 16 x F(RE 15 , K 16 )
[AxB]xC=Ax[BxC]
DxD=0
Ex0=E
LE i = RE i-1
RE i =LE i -1 x F(RE i -1 , K i )
Rearranging terms,
RE i -1 = LE i
LE i -1 = RE i x F(RE i -1 , K i )
DATA ENCRYPTION STANDARD (DES)
most widely used block cipher in world
Adopted in 1977 by the National Bureau of Standards, now the National Institute of
Standards and Technology
DES History
IBM developed Lucifer cipher
then redeveloped as a commercial cipher with input from NSA and others
in 1973 NBS issued request for proposals for a national cipher standard
IBM submitted their revised Lucifer which was eventually accepted as the DES
The left side shows the basic process for enciphering a 64-bit data block which consists
of:
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 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.
INITIAL PERMUTATION IP
first step of the data computation
It happens only once and before the first round.
IP reorders the input data bits
IP produces two halves of the permuted block. LH half, RH half
To see that these two permutation functions are indeed the inverse of each other,consider the
following 64-bit input M:
Li = Ri–1
Ri = Li–1 xor F(Ri–1, Ki)
o adds to subkey
SUBSTITUTION BOXES S
– consists of:
o initial permutation of the key (PC1) which selects 56-bits in two 28-bit halves
DES Decryption
Avalanche Effect
STRENGTH OF DES
Nature of algorithm
– the design criteria for the S boxes ,and indeed for the entire algorithm,
were not made public, there is a suspicion that the boxes were
constructed in such a way that cryptanalysis is possible for an
opponent who knows the weaknesses in the S-boxes.
– This assertion is tantalizing, and over the years a number of
regularities and unexpected behaviors of the S-boxes have been
discovered.
Timing Attacks
– specifically use fact that calculations can take varying times depending
on the value of the inputs to it
Analytic Attacks
– now have several analytic attacks on DES
– these utilise some deep structure of the cipher
o by gathering information about encryptions
o can eventually recover some/all of the sub-key bits
o if necessary then exhaustively search for the rest
– generally these are statistical attacks
– include
o differential cryptanalysis
o linear cryptanalysis
Differential Cryptanalysis
Linear Cryptanalysis
• Can attack DES with known plaintexts, easier but still in practice
infeasible
• Good confusion
No output bit of any S-box should be too close a linear function of the input bits.
Specifically, if we select any output bit and any subset of the six input bits, the
fraction of inputs for which this output bit equals the XOR of these input bits
should not be close to 0 or 1,but rather should be near 1/2.
Each row of an S-box (determined by a fixed value of the leftmost and rightmost
input bits) should include all 16 possible output bit combinations.
If two inputs to an S-box differ in exactly one bit, the outputs must differ in at
least two bits.
If two inputs to an S-box differ in the two middle bits exactly,the outputs must
differ in at least two bits.
If two inputs to an S-box differ in their first two bits and are identical in their last
two bits,the two outputs must not be the same.
For any nonzero 6-bit difference between inputs,no more than eight of the 32
pairs of inputs exhibiting that difference may result in the same output difference.
This is a criterion similar to the previous one, but for the case of three S-boxes.
The four output bits from each S-box at round are distributed so that two of them
affect (provide input for) “middle bits” of round and the other two affect end
bits.The two middle bits of input to an S-box are not shared with adjacent S-
boxes.The end bits are the two left-hand bits and the two right-hand bits,which are
shared with adjacent S-boxes.
The four output bits from each S-box affect six different S-boxes on the next
round,and no two affect the same S-box.
For two S-boxes , , if an output bit from affects a middle bit of on the next round,
then an output bit from cannot affect a middle bit of .This implies that,for ,an
output bit from must not affect a middle bit of . These criteria are intended to
increase the diffusion of the algorithm.
Three critical aspects of block cipher design:
the number of rounds,
design of the function F,and
key scheduling.
The greater the number of rounds, the more difficult it is to perform cryptanalysis
The criterion should be that the number of rounds is chosen so that known cryptanalytic
efforts require greater effort than a simple brute-force key search attack.
This criterion was certainly used in the design of DES.
If DES had 15 or fewer rounds, differential cryptanalysis would require less effort than a
brute-force key search.
This criterion is attractive, because it makes it easy to judge the strength of an algorithm
and to compare different algorithms.
In the absence of a cryptanalytic breakthrough, the strength of any algorithm that satisfies
the criterion can be judged solely on key length.
2. Design of Function F
The heart of a Feistel block cipher is the function F.
in DES, this function relies on the use of S-boxes.
DESIGN CRITERIA FOR F
o The function F provides the element of confusion in a Feistel cipher.
o One criterion is that F be nonlinear, The more nonlinear F, the more difficult any
type of cryptanalysis will be.
o The algorithm should have good avalanche properties, this means that a change in
one bit of the input should produce a change in many bits of the output. ie;strict
avalanche criterion (SAC)
o Another criterion is the bit independence criterion (BIC),which states that
output bit „j‟ and „k‟ should change independently and should change
independently when any single input bit „i‟ is inverted for all „i‟ , „j‟ ,‟k‟
o S-BOX DESIGN
Larger S-boxes, by and large, are more resistant to differential and
linear cryptanalysis
3. key scheduling.
select subkeys to maximize the difficulty of deducing individual subkeys and the
difficulty of working back to the main key.
No general principles for this have yet been promulgated.
5. COUNTER (CTR)
a “new” mode, though proposed early on
similar to OFB but encrypts counter value rather than any feedback value
Oi = EK(i)
Ci = Pi XOR Oi
must have a different key & counter value for every plaintext block (never reused)
uses: high-speed network encryptions