8. network security

88
8. Network Security

Upload: dorit

Post on 12-Jan-2016

17 views

Category:

Documents


0 download

DESCRIPTION

8. Network Security. Introduction. Network Security deals with 4 basic problems: Secrecy - Confidentiality Authentication – Determining whom ur talking. The process of proving one's identity. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 8. Network Security

8. Network Security

Page 2: 8. Network Security

Introduction

Network Security deals with 4 basic problems:

1. Secrecy - Confidentiality2. Authentication – Determining whom ur talking.

The process of proving one's identity. 3. Non-repudiation – deals with signatures. A

mechanism to prove that the sender really sent this message

4. Integrity Control – Msg is the real one. Assuring the receiver that the received message has not been altered in any way from the original

Page 3: 8. Network Security

Cryptography

Comes from the Greek words for ''secret writing.''

Distinction between ciphers and codes– A cipher is a character-for-character or bit-

for-bit transformation (Encryption & Decryption algorithm)

– a code replaces one word with another word or symbol (not used any more)

Page 4: 8. Network Security

Introduction to Cryptography

P = Dk(C)

Page 5: 8. Network Security

Introduction to Cryptography

Cryptanalysis – Art of breaking ciphers Cryptology – Art of devising them

(cryptography) Key : Is a number/character or a set of

number/character that the cipher or algorithm operates on.

Use of Key:– Everytime changing algorithm is impractical.

Kerchkhoff’s Principle – All algorithm must be public; only the keys are secret.

Longer the key, higher the work factor

Page 6: 8. Network Security

Encryption methods

Divided into two categories: – Substitution ciphers

• In a substitution cipher each letter or group of letters is replaced by another letter or group of letters to disguise it.

• Preserve the order of the plaintext • 'fly at once' becomes 'gmz bu podf' by replacing each

letter with the one following it in the alphabet.

– Transposition ciphers • Reorder the letters but do not disguise them • Eg : 'help me' becomes 'ehpl em' in a trivially simple

rearrangement scheme

Page 7: 8. Network Security

Substitution Ciphers

Caesar cipher – The ciphertext alphabet to be shifted by k

letters – For example if k=3 then

• a becomes D, b becomes E, c becomes F, ... w becomes Z, x becomes A ….. and z becomes C

Page 8: 8. Network Security

Substitution Ciphers

Improvement – Monoalphabetic Substitution – Each of the symbols in the plaintext, say, the 26

letters for simplicity, map onto some other letter – plaintext:

a b c d e f g h i j k l m n o p q r s t u v w x y z

– ciphertext: Q W E R T Y U I O P A S D F G H J K L Z X C V B N M

Eg : attack - QZZQEA

Page 9: 8. Network Security

Breaking Substitution Ciphers

‘e’ is the most common letter in English e is commonly followed by t,o,a,n,I etc Digrams: two letter combinations

– th,in,er,re,an…. Trigrams : three letter combinations

– the,ing,and,ion Find out the frequency of each letters. Assign the max frequency to ‘e’ Then the next freq value to t Then look at trigrams tXe,which strongly suggest X=h Similarly if the pattern thYt occurs frequently => Y=a aZW = and

Page 10: 8. Network Security

Transposition Ciphers

Page 11: 8. Network Security

One-Time Pads

Unbreakable cipher Steps:

1. Choose a random bit string as the key

2. Convert plaintext into bit string using ASCII

3. XOR two strings

Disadvantage:– Memorizing the key– Total amount of data is that can be transmitted is

limited by amount of key

Page 12: 8. Network Security

One-Time Pads

Page 13: 8. Network Security

Quantum Cryptography

Uses Quantum Mechanics to guarantee secure communication.

It enables two parties to produce a shared random bit string known only to them, which can be used as a key to encrypt and decrypt messages.

Vertical = 0 Horizontal = 1 Lower left to Upper Right = 0 Upper left to Lower Right = 1 Rectilinear Basis = set of vertical to horizontal filter Diagonal basis = same as rectilinear except rotated

at 45 degree

Page 14: 8. Network Security

Example of Quantum Cryptography

Page 15: 8. Network Security

Types of Cryptography Algorithms (Modern Methods)1. Symmetric Key (Secret key)

Same key is used by both parties

2. Asymmetric key(Public key) Two keys are used Private & Public Key Private key is kept by the receiver. Public key is announced public

Page 16: 8. Network Security
Page 17: 8. Network Security

Symmetric-Key Algorithms

Uses same key for encryption and decryption Block Ciphers – n-bit of block of plaintext as input

transformed into n-bit block of ciphertext. Cryptographic algorithms can be implemented in

either hardware (for speed) or in software (for flexibility).

P-Box (Permutation) – By appropriate internal wiring, it can be made to perform any transposition– Uses 8 bit of data

Page 18: 8. Network Security

H/W implementation of transposition cipher

01234567 ?

Page 19: 8. Network Security

H/W implementation of transposition cipher

01234567 ? 36071245

Page 20: 8. Network Security

H/W implementation of substitution cipher

01234567 ?

Page 21: 8. Network Security

H/W implementation of substitution cipher

01234567 ? 24506713

Page 22: 8. Network Security

product cipher

•212=4096 crossed wires

•K bit input = 64 to 256

•18 Physical stages other than 7

Page 23: 8. Network Security

DES (Data Encryption Standard)

Product cipher developed by IBM Plaintext is encrypted in blocks of 64 bits,

yielding 64 bits of ciphertext 56-bit key, 19 distinct stages The first stage is a key-independent

transposition on the 64-bit plaintext The last stage is the exact inverse of this

transposition The stage prior to the last one exchanges the

leftmost 32 bits with the rightmost 32 bits.

Page 24: 8. Network Security
Page 25: 8. Network Security

The remaining 16 stages

Each stage takes two 32-bit inputs and produces two 32-bit outputs.

The left output is simply a copy of the right input.

The right output is the bitwise XOR of the left input and a function of the right input and the key for this stage, Ki.

All the complexity lies in this function

Page 26: 8. Network Security
Page 27: 8. Network Security

Function. The function consists of four steps First, a 48-bit number, E, is constructed by

expanding the 32-bit Ri - 1 according to a fixed transposition and duplication rule

Second, E and Ki are XORed together This output is then partitioned into eight

groups of 6 bits each, each of which is fed into a different S-box. Each of the 64 possible inputs to an S-box is mapped onto a 4-bit output.

Finally, these 8 x 4 bits are passed through a P-box.

Page 28: 8. Network Security

FIESTEL FUNCTION (F-Function)

48 bit

Page 29: 8. Network Security

Key

Before the algorithm starts, a 56-bit transposition is applied to the key

Before each iteration, the key is partitioned into two 28-bit units, each of which is rotated left by a number of bits dependent on the iteration number

Yet another 56-bit transposition to it. A different 48-bit subset of the 56 bits is extracted and permuted on each round

Page 30: 8. Network Security

Whitening

It consists of XORing a random 64-bit key with each plaintext block before feeding it into DES

and then XORing a second 64-bit key with the resulting ciphertext before transmitting it.

Page 31: 8. Network Security

Triple DES

To increase the key length of DES

Page 32: 8. Network Security

Raised two questions (Triple DES)

1. Why two keys not three? 112(56*2) is adequate for commercial

applications. 168 (56*3) bit key just increases

overhead.

2. Why EDE & not EEE? Using triple encryption can speak to one

using single encryption by just setting K1 = K2.

Page 33: 8. Network Security

AESThe Advanced Encryption Standard The algorithm must be a symmetric block

cipher. The full design must be public. Key lengths of 128, 192, and 256 bits must

be supported. Both software and hardware

implementations must be possible. The algorithm must be public or licensed on

nondiscriminatory terms.

Page 34: 8. Network Security

AESThe Advanced Encryption Standard

Fifteen serious proposals were made In August 1998, NIST (National Institute

of Standards and Technology)selected five finalists primarily on the basis of their security, efficiency, simplicity, flexibility, and memory requirements

Page 35: 8. Network Security

The finalists and their scores were as follows:

Rijndael (from Joan Daemen and Vincent Rijmen, 86 votes).

Serpent (from Ross Anderson, Eli Biham, and Lars Knudsen, 59 votes).

Twofish (from a team headed by Bruce Schneier, 31 votes).

RC6 (from RSA Laboratories, 23 votes). MARS (from IBM, 13 votes).

Page 36: 8. Network Security

Rijndael

Key & Block size : Supports 128 bits to 256 bits

AES has two variants:– 128 bit block with 128 bit key– 128 bit block with 256 bit key

128 bit key => 2128 = 3*1038

1 billion processor which can evaluate 1 key per picosecond (10−12 seconds) it would take 1010 yrs to search the key space.

Page 37: 8. Network Security

Rijndael

Also uses Permutation & Substitution There are Multiple rounds/iterations

which depends on key size– 10 rounds for 128 bit key– 14 rounds for 256 bit key

Page 38: 8. Network Security

An outline of Rijndael

Page 39: 8. Network Security

AES

Page 40: 8. Network Security

Step 1 (Byte by Byte substitution on state using S Box)Rijndael uses only one SBox unlike DES which uses multiple SBox

Page 41: 8. Network Security

Step 2 (Rotation)

Page 42: 8. Network Security

Step 3 (Mix Columns)

Page 43: 8. Network Security

Step 4 (AddRoundKey step )

Page 44: 8. Network Security

Cipher Modes

Property of Block Ciphers– The same plaintext block goes in the front end, the

same ciphertext block comes out the back end – If you encrypt the plaintext abcdefgh 100 times

with the same DES key, you get the same ciphertext 100 times

– Electronic Code Book Mode : Breaking up long piece of plaintext into 8 byte(64 bit) and encrypting it.

Page 45: 8. Network Security

Electronic Code Book Mode

The plaintext of a file encrypted as 16 DES blocks.

Page 46: 8. Network Security

Cipher Modes

Cipher Block Chaining Mode Cipher Feedback Mode Stream Cipher Mode Counter Mode

Page 47: 8. Network Security

Cipher Block Chaining Mode

Page 48: 8. Network Security

Cipher Block Chaining Mode

Each plaintext block is XORed with the previous ciphertext block before being encrypted

The first block is XORed with a randomly chosen IV (Initialization Vector), which is transmitted (in plaintext) along with the ciphertext.

Page 49: 8. Network Security

Cipher Block Chaining Mode - Decryption

Page 50: 8. Network Security

Cipher Block Chaining Mode(Advantage & Disadvantage) Adv:

– Same plaintext block will not result in the same ciphertext block

Disadv : – Requiring an entire 64-bit block to arrive

before decryption can begin

Page 51: 8. Network Security

Cipher Feedback Mode

Page 52: 8. Network Security

Cipher Feedback Mode

Uses DES or AES methods– For DES – 64 bit shift register is used– For AES – 128 bit shift register is used

Page 53: 8. Network Security

Cipher Feedback Mode When plaintext byte 10 arrives, as illustrated

in Fig, the DES algorithm operates on the 64-bit shift register to generate a 64-bit ciphertext.

The leftmost byte of that ciphertext is extracted and XORed with P10.

That byte is transmitted on the transmission line.

In addition, the shift register is shifted left 8 bits, causing C2 to fall off the left end, and C10 is inserted in the position just vacated at the right end by C9.

Page 54: 8. Network Security

Cipher Feedback Mode (Decryption) Here the content of the shift register is

encrypted & not decrypted As long as the shift registers remain

identical, decryption works correctly.

Page 55: 8. Network Security

Cipher Feedback Mode

Page 56: 8. Network Security

Problem with CFM

If one bit of the ciphertext is accidentally inverted during transmission

The 8 bytes that are decrypted while the bad byte is in the shift register will be corrupted.

Once the bad byte is pushed out of the shift register, correct plaintext will once again be generated.

Thus, the effects of a single inverted bit are relatively localized and do not ruin the rest of the message,

But they do ruin as many bits as the shift register is wide.

Page 57: 8. Network Security

Stream Cipher Mode

Page 58: 8. Network Security

Stream Cipher Mode

It works by encrypting an initialization vector, using a key to get an output block.

The output block is then encrypted, using the key to get a second output block.

This block is then encrypted to get a third block, and so on.

The sequence of output blocks, called the keystream, is treated like a one-time pad and XORed with the plaintext to get the ciphertext, as shown in Fig.

Note that the IV is used only on the first step. After that, the output is encrypted

Page 59: 8. Network Security

Stream Cipher Mode

Page 60: 8. Network Security

Random access problem

One problem that all the modes except electronic code book mode have is that random access to encrypted data is impossible

With a file encrypted using cipher block chaining, accessing a random block requires first decrypting all the blocks ahead of it, an expensive proposition.

For this reason, yet another mode has been invented, counter mode, as illustrated in Fig

Page 61: 8. Network Security

Counter Mode

Page 62: 8. Network Security

Counter Mode

Here the plaintext is not encrypted directly. Instead, the initialization vector plus a

constant is encrypted, and the resulting ciphertext XORed with the plaintext.

By stepping the initialization vector by 1 for each new block, it is easy to decrypt a block anywhere in the file without first having to decrypt all of its predecessors.

Page 63: 8. Network Security

A few of the more common ones are listed in Fig

Page 64: 8. Network Security

Public-Key Algorithms

Encryption algorithm, E, and the Decryption algorithm, D, had to meet three requirements

1. D(E(P)) = P.2. It is exceedingly difficult to deduce D

from E.3. E cannot be broken by a chosen

plaintext attack.

Page 65: 8. Network Security

Public-Key Cryptography

Page 66: 8. Network Security

RSA

Known by the initials of the three discoverers

(Rivest, Shamir, Adleman) Its major disadvantage is that it requires keys

of at least 1024 bits for good security (versus 128 bits for symmetric-key algorithms), which makes it quite slow.

RSA has survived all attempts to break it for more than a quarter of a century and is considered very strong

Page 67: 8. Network Security

How to use the method

1. Choose two large primes, p and q (typically 1024 bits).

2. Compute n = p x q and z = (p - 1) x (q - 1).

3. Choose a number relatively prime to z and call it d.

4. Find e such that e x d = 1 mod z.• Or e x d mod z = 1

Page 68: 8. Network Security

how to use the method

To encrypt a message, P, compute

C = Pe (mod n). To decrypt C, compute

P = Cd (mod n)

Public Key consists of pair (e,n)

Private Key consists of pair (d,n)

Page 69: 8. Network Security

RSA Example

p=3 q=11 n = p*q = 33 z = (p-1)*(q-1) = 2*10 = 20 e*d % z = 1 21 % 20 = 1 21 = 7*3 e=3 and d=7

Page 70: 8. Network Security

An example of the RSA algorithm

Page 71: 8. Network Security

Ciphertext C for all the possible values of m (0 to 32)

Page 72: 8. Network Security
Page 73: 8. Network Security

Digital Signatures

One party can send a signed message to another party in such a way that the following conditions hold:

1. The receiver can verify the claimed identity of the sender.

2. The sender cannot later repudiate the contents of the message.

3. The receiver cannot possibly have concocted the message himself.

Page 74: 8. Network Security

Two Methods - 1) Symmetric Key Signatures

Page 75: 8. Network Security

Issues related to Symmetric Key Signatures

Alice later denies having send the message– BB will never get a message other than

Alice. Otherwise how will be decrypt using KA

– Bob will present KBB(A, t, P)

Replay of Message– timestamp

Page 76: 8. Network Security

2. Public Key Signatures D(E(P)) = P E(D(P)) = P RSA has this property.

Page 77: 8. Network Security

Issues related to Public Key Signatures

Alice denies– Bob will produce P and DA(P).

– Bob does not know Alice private key, so he cannot get DA(P)

Page 78: 8. Network Security

Problems related to Signature Scheme

Alice discloses her private key to all. Alice changes her public-private key.

– Applying EA on DA(P) will not produce P.

Signature schemes perform Authentication and Secrecy both.

Page 79: 8. Network Security

Message Digests

One-way hash function that takes an arbitrarily long piece of plaintext and from it computes a fixed-length bit string.

This hash function, MD, often called a message digest, has four important properties:1. Given P, it is easy to compute MD(P).2. Given MD(P), it is effectively impossible to find P.3. Given P no one can find P' such that MD (P') = MD(P).4. A change to the input of even 1 bit produces a very different

output. Hash should be atleast 128 bit long Faster than signature method

Page 80: 8. Network Security

Message Digests

ALICE

A,KA,(B,RA,t,P)

BB

KB(A,RA,t,P,KBB(A,t,MD(P))

BOB

Page 81: 8. Network Security

Message Digests – Public key cryptosystems

Page 82: 8. Network Security

MD5

Plaintext pad it to make length of multiple 512 bits

Initialize a 128 bit buffer to a fixed value Mix 512 bits of data with 128 bit buffer Four rounds are performed per input block.

This process continues until all the input blocks have been consumed.

The contents of the 128-bit buffer form the message digest.

Page 83: 8. Network Security

SHA1 – Secure Hash Algorithm Input data in 512-bit blocks Generates a 160-bit message digest.

Page 84: 8. Network Security

SHA1

Page 85: 8. Network Security

SHA1

5 Hash variables - H0 to H4 with 32 bit data each W – Word Array (80 in number) 16 words are copied in W0 to W15 Rest other 64 W’s are filled using following formula:

– Sb(W) represents the left circular rotation of the 32-bit word, W, by b bits.

Page 86: 8. Network Security

SHA1

The actual calculation can be expressed in pseudo-C as

for (i = 0; i < 80; i++) { temp = S5(A) + fi (B, C, D) + E + Wi +Ki; E=D; D=C; C=S30(B); B = A; A = temp; } Five scratch variables, A through E are

initialized from H0 through H4

Page 87: 8. Network Security

SHA1

The mixing functions fi are defined as

• Now that the first 512-bit block has been processed, the next one is started.

•The W array is reinitialized from the new block, but H is left as it was.

Page 88: 8. Network Security

Birthday Attack

Birthday attacks are often used to find collisions of hash functions

Alice wants to trick Bob into signing a fraudulent contract. Alice prepares a fair contract A and a fraudulent one B She finds a version of the fair contract and a version of the

fraudulent contract which have the same hash value, f(A) = f(B).

She presents the fair version to Bob for signing. After Bob has signed, Alice takes the signature and attaches it to the fraudulent contract.

This signature then "proves" that Bob signed the fraudulent contract.

To avoid this attack, the output length of the hash function used for a signature scheme can be chosen large enough so that the birthday attack becomes computationally infeasible