+ All Categories
Home > Documents > Introduction to Computer Security

Introduction to Computer Security

Date post: 25-Feb-2016
Category:
Upload: len
View: 43 times
Download: 0 times
Share this document with a friend
Description:
Introduction to Computer Security. Basic Cryptography (Part I). Introduction. Cryptography Original meaning: The art of secret writing Becoming a science that relies on mathematics (number theory, algebra) Process data into unintelligible form, reversible, without data loss - PowerPoint PPT Presentation
Popular Tags:
55
1 Introduction to Computer Security Basic Cryptography (Part I)
Transcript
Page 1: Introduction to Computer Security

1

Introduction to Computer Security

Basic Cryptography (Part I)

Page 2: Introduction to Computer Security

2

Introduction• Cryptography

– Original meaning: The art of secret writing– Becoming a science that relies on mathematics

(number theory, algebra)– Process data into unintelligible form, reversible,

without data loss– Usually one-to-one (not compression)

Page 3: Introduction to Computer Security

• What is Elementary Cryptography?– “Hidden Writing”– Increasingly used to protect Information.

• Goal of Cryptography– Ensure security of communication over insecure

medium• Privacy (secrecy, confidentiality)• Integrity

– Communicate even with possibility of adversaries

Introduction

Page 4: Introduction to Computer Security

4

plaintextencryption

ciphertextdecryption

plaintext

key key

Encryption/Decryption

• Plaintext: a message in its original form• Ciphertext: a message in the transformed, unrecognized form• Encryption: the process that transforms a plaintext into a

ciphertext; also known as encode and encipher• Decryption: the process that transforms a ciphertext to the

corresponding plaintext; also known as decode and decipher• Key: the value used to control encryption/decryption• Cryptosystem: a system for encryption and decryption

Page 5: Introduction to Computer Security

• C = E(P) and P = D(C)where C represents the ciphertext, E is the

encryption rule, P is the plaintext, and D is the decryption rule

5

Page 6: Introduction to Computer Security

• cryptography :hidden writing, and it refers to the practice of using encryption to conceal text.

• cryptanalyst :studies encryption and encrypted messages, hoping to find the hidden meanings.

• cryptology : is the research into and study of encryption and decryption; it includes both cryptography and cryptanalysis.

6

Page 7: Introduction to Computer Security

7

Cryptanalysis

• Ciphertext only:– Analyze only with the ciphertext– Example: Exhaustive search until “recognizable

plaintext”– Smarter ways available

• Known plaintext:– Secret may be revealed (by spy, time), thus

<ciphertext, plaintext> pair is obtained– Great for mono-alphabetic ciphers

Page 8: Introduction to Computer Security

8

Cryptanalysis (Cont’d)

• Chosen plaintext:– Choose text, get encrypted– Useful if limited set of messages

• Chosen ciphertext:– Choose ciphertext– Get feedback from decryption, etc.

Page 9: Introduction to Computer Security

Representing Characters• Because most encryption algorithms are based on mathematical

transformations, they can be explained or studied more easily in mathematical form.

• A + 3 = D or K - 1 = J , Y + 3 = B.

9

Page 10: Introduction to Computer Security

10

Simple Forms of Encryption

• Substitutions– One letter is replaced with another

• Transpositions– Also called permutations– The order of the letters is rearranged

• Building blocks of modern cryptographic algorithms

Page 11: Introduction to Computer Security

11

Substitution Ciphers• Monoalphabetic cipher (simple substitution)

– Use a correspondence table– Substitute a character or symbol for each character of the

original message– Example: Caesar cipher

• Replace each letter with the one 3 letters later

• E(TREATY IMPOSSIBLE ) wuhdwb lpsrvvleoh• Exercise

– E (“COMPUTER SCIENCE”) – D (“qf vwdwh”)

A B C D E F G H I J K L M

d e f g h i j k l m n o p

N O P Q R S T U V W X Y Z

q r s t u v w x y z a b c

Page 12: Introduction to Computer Security

12

Caesar Cipher

• Cryptanalysis of Caesar cipher– Can be done by guessing

• Clues– Break between two words is preserved

• You can try common letters starting or ending a word– Double letters are preserved(The SS is translated to vv)– Always use the same mapping (the letters T, I, and E always

translate to w, l, and h)– Exercise:

•wklv phvvdjh lv qrw wrr kdug wr euhdn

Page 13: Introduction to Computer Security

13

Other Substitutions

• In general– The alphabet is scrambled– Each plaintext letter maps to a unique ciphertext letter– A substitution table can be defined using a permutation

• A permutation is a reordering of the elements of a sequence

A B C D E F G H I J K L M

d x f t h i w k y m n o p

N O P Q R S T U V W X Y Z

q r s g u v j e l z a b c

Page 14: Introduction to Computer Security

14

Cryptanalysis of Substitution Ciphers

• Ad hoc clues– Short words, words with repeated patterns,

common initial and final letters• Language specific knowledge

– Frequency of letters• E, T, O, and A occur far more often than J, Q, X, and Z

– Letter patterns• th, er, en, ss, st, …

Page 15: Introduction to Computer Security

Example:• One way to scramble an alphabet is to use a key, a word that controls the

permutation. For instance, if the key is word, the sender or receiver first writes the alphabet and then writes the key under the first few letters of the alphabet.

• ABCDEFGHIJKLMNOPQRSTUVWXYZ word

The sender or receiver then fills in the remaining letters of the alphabet, in some easy-to-remember order, after the keyword.

• ABCDEFGHIJKLMNOPQRSTUVWXYZ

wordabcefghijklmnpqstuvxyz In this example, the key is short, so most plaintext letters are only one or two

positions off from their ciphertext equivalents. With a longer keyword, the distance is greater and less predictable

15

Page 16: Introduction to Computer Security

16

One-Time Pads

• Encrypt plaintext with a large, non-repeating set of keys – Absolute synchronization between sender and receiver– Unlimited number of keys

Vernam cipher

Page 17: Introduction to Computer Security

The one-time pad method has two problems:

• the need for absolute synchronization between sender and receiver.

• the need for an unlimited number of keys. (printing, distributing, storing, and accounting keys)

17

Page 18: Introduction to Computer Security

Vernam cipher Example:• message is VERNAM CIPHER1. the letters are represented with numbers 0 through 25.2. the letters would first be converted to their numeric equivalents, as shown

here.

3. generate random numbers to combine with the letter codes76 48 16 82 44 03 58 11 60 05 48 88

4. The encoded form of the message is the sum mod 26 of each coded letter with the corresponding random number. The result is then encoded in the usual base-26 alphabet representation.

18

Page 19: Introduction to Computer Security

19

Book Cipher

• Use book, piece of music, or other object with which structure can be analyzed– Both sender and receiver need access to identical objects– Example: book cipher with Vigenère tableau

• Key: I am, I exist, that is certain.• Plaintext: MACHINES CANNOT THINK

iamie xistt hatis certMACHI NESCA NNOTT HINKUaopm kmkvt unbhl jmed

columnrow

Page 20: Introduction to Computer Security

20

Cryptanalysis of Book Cipher• Flaw of book cipher

– Distributions of both key and message cluster around high frequency letters

– Example• A, E, O, T, N, I account for 50% of all letters• Probability of both key and plaintext letters are one of them: 0.25

• Cryptanalysis– Look for intersections of the above six letters– For each cipher text letter, identify the possible plaint text letter from

those intersections

uaopm kmkvt unbhl jmed?AA?E ?E??A ?ANN? ?EA? O I I T NTT IE T T T

Correct predictionunderlined

Page 21: Introduction to Computer Security

21

Transpositions (Permutations)

• Letters of the message are rearranged– Aim to break established patterns

• Confusion and diffusion– Confusion

• Make it difficult to determine how message and key are transformed into cipher text

• Complex relationship between plaintext, key, and ciphertext• Done through substitution

– Diffusion• Widely spread the information from the message or key across the

cipher text• Done through transposition (permutation)

Page 22: Introduction to Computer Security

22

Columnar Transpositions

• Rearrange characters of the plain text into columns

Key: 4 3 1 2 5 6 7Plaintext: A T T A C K P

O S T P O N ED U N T I L T

W O A M X Y Z

Cipher text: ______________________________________

Page 23: Introduction to Computer Security

23

Cryptanalysis of Transpositions

• Diagram analysis– Frequent diagram

• Patterns of pairs of adjacent letters• RE, EN, ER, NT, …

– Frequent trigrams• Groups of three letters• ENT, ION, AND, ING, …

– Infrequent diagrams and trigrams• VK and QP

Page 24: Introduction to Computer Security

24

Page 25: Introduction to Computer Security

25

Cryptanalysis by Diagram Analysis

• Confirms it is a transposition– Compute the letter frequencies

• Find adjacent columns– Try different column sizes– Look for common diagrams– Verify possible matches for different positions

• Rely heavily on a human’s judgment of what “looks right”

Page 26: Introduction to Computer Security

26

Product Cipher

• Product cipher– Combination of two ciphers– Modern ciphers: interleaved substitutions and

transpositions (permutations)– SPSP…

• But– How about SPSSP…– How about SPPS…

Page 27: Introduction to Computer Security

27

“Good” Encryption algorithms

• What does it mean for a cipher to be “good”?– Meaning of “good” depends on intended use of the

cipher– Commercial applications– Military applications

Page 28: Introduction to Computer Security

28

Characteristics of “Good” Ciphers• Shannon’s principles

– The amount of secrecy needed should determine the amount of labor appropriate for the encryption and decryption

– The set of keys and the enciphering algorithm should be free from complexity

• No restrictions on keys or plain text; keys should be short(For instance, an algorithm that works only on plaintext having an equal number of A's and E's is useless, the key must be transmitted, stored, and remembered, so it must be short.)

– The implementation of the process should be as simple as possible

• Formulated with hand encryption in mind• Implementation on a computer need not be simple, as long as the

time complexity is tolerable

Page 29: Introduction to Computer Security

29

Characteristics of “Good” Ciphers

• Shannon’s Principles (Cont’d)– Errors in ciphering should not propagate and cause

corruption of further information in the message• No error propagation

– The size of the enciphered text should be no larger than the text of the original message

• Dramatic cipher expansion in size does not carry more information, but

• It gives the cryptanalyst more data to infer patterns

Page 30: Introduction to Computer Security

30

Security of An Encryption Algorithm

• Unconditionally secure– It is impossible to decrypt the ciphertext– One-time pad (the key is as long as the plaintext)

• Computationally secure– The cost of breaking the cipher exceeds the value of the

encrypted information– The time required to break the cipher exceeds the useful

lifetime of the information

Ci Pi K i

Page 31: Introduction to Computer Security

31

Secret Keys v.s. Secret Algorithms

• Security by obscurity– We can achieve better security if we keep the

algorithms secret– Hard to keep secret if used widely

• Publish the algorithms– Security of the algorithms depends on the secrecy

of the keys– Less unknown vulnerability if all the smart (good)

people in the world are examine the algorithms

Page 32: Introduction to Computer Security

32

Secret Keys v.s. Secret Algorithms (Cont’d)

• Commercial world– Published– Wide review, trust

• Military– Keep algorithms secret– Avoid giving enemy good ideas

Page 33: Introduction to Computer Security

33

Types of Cryptography

• Number of keys– Hash functions: no key– Secret key cryptography: one key– Public key cryptography: two keys - public, private

• The way in which the plaintext is processed– Block cipher: divides input elements into blocks– Stream cipher: process one element (e.g., bit) a

time

Page 34: Introduction to Computer Security

Encryption Algorithm

Symmetric Same key for encryption and decryption Key distribution problem

Asymmetric Mathematically related key pairs for encryption and

decryption Public and private keys

Page 35: Introduction to Computer Security

35

plaintextencryption

ciphertextdecryption

plaintext

key keySame key

Secret Key Cryptography

• Same key is used for encryption and decryption• Also known as

– Symmetric cryptography– Conventional cryptography

Page 36: Introduction to Computer Security

36

Secret Key Cryptography (Cont’d)

• Basic technique– Product cipher– Multiple applications of interleaved substitutions and

permutations• Cipher text approximately the same length as

plaintext

plaintext S P S P S ciphertext…

key

Page 37: Introduction to Computer Security

37

Stream and Block Ciphers

• Stream ciphers– Convert one symbol of plaintext immediately into a symbol

of ciphertext• A symbol: a character, a bit

– Examples• Substitution ciphers discussed earlier• Modern example: RC4

Page 38: Introduction to Computer Security

38

Stream and Block Ciphers (Cont’d)

• Block cipher– Encrypt a group of

plaintext symbols as on block

– Examples• Columnar

transposition• Modern examples:

DES, AES

Page 39: Introduction to Computer Security

39

Applications of Secret Key Cryptography

• Transmitting over an insecure channel– Challenge: How to share the key?

• Secure Storage on insecure media• Authentication

– Challenge-response– To prove the other party knows the secret key– Must be secure against chosen plaintext attack

• Integrity check– Message Integrity Code (MIC)– Also called Message Authentication Code (MAC)

Page 40: Introduction to Computer Security

40

plaintextencryption

ciphertextdecryption

plaintext

Public key Private key

Public Key Cryptography

• Invented/published in 1975• A public/private key pair is used

– Public key can be publicly known– Private key is kept secret by the owner of the key

• Much slower than secret key cryptography• Also known as

– Asymmetric cryptography

Page 41: Introduction to Computer Security

41

messageSign Digital

signature VerifyYes/No

Private key Public key

Public Key Cryptography (Cont’d)

• Another mode: digital signature– Only the party with the private key can create a digital

signature.– The digital signature is verifiable by anyone who knows the

public key.– The signer cannot deny that he/she has done so.

Page 42: Introduction to Computer Security

Comparison

Secret Key (Symmetric) Public Key (Asymmetric)Number of Key 1 2Protection of Key Must be kept secret One key must be kept

secret 7 other can be freely exposed

Best Uses Cryptographic workhorse; secrecy and integrity of data, single characters to blocks of data, messages, files

Key exchange, authentication

Key Distribution Must be out-of-band Public key can be used to distribute other keys

Speed Fast Slow; typically, 10,000 times slower than secret key

Page 43: Introduction to Computer Security

43

DES (Data Encryption Standard)• Officially adopted in 1976• Expired in 1998• Key: 64 bit quantity=8-bit parity+56-bit key

– Every 8th bit is a parity bit.• 64 bit input, 64 bit output.

DESEncryption

64 bit M 64 bit C

56 bits

Page 44: Introduction to Computer Security

44

DES Top View

Permutation

Permutation

Swap

Round 1

Round 2

Round 16

Generate keysInitial Permutation

48-bit K1

48-bit K2

48-bit K16

Swap 32-bit halves

Final Permutation

64-bit Output

64-bit Input56-bit Key

…...

Page 45: Introduction to Computer Security

45

Bit Permutation (1-to-1)

…….

……..

1 2 3 4 32

22 6 13 32 3

Input:

Output

0 0 1 0 1

1 0 1 1 1

1 bit

Page 46: Introduction to Computer Security

46

Initial and Final Permutations

• Initial permutation (IP)• View the input as M: 8 X 8 bit matrix• Transform M into M’ in two steps

– Transpose row x into column (9-x), 0<x<9– Apply permutation on the rows:

• For even row y, it becomes row y/2• For odd row y, it becomes row (5+y/2)

• Final permutation FP = IP-1

Page 47: Introduction to Computer Security

47

Per-Round Key Generation

28 bits 28 bits

48 bitsKi

Circular Left Shift Circular Left Shift

28 bits 28 bits

Permutationwith Discard

Initial Permutation of DES key

C i-1 D i-1

C i D i

Round 1,2,9,16: single shiftOthers: two bits

Page 48: Introduction to Computer Security

48

A DES Round

48 bits

32 bits

32 bits 32 bits

32 bits 32 bits

E-Boxes

S-Boxes

P

KiOne RoundEncryption Mangler

Function

Page 49: Introduction to Computer Security

49

E Box of DES (Expansion Permutation)

32 1 2 3 4 54 5 6 7 8 98 9 10 11 12

13

12 13 14 15 16 1716 17 18 19 20 2120 21 22 23 24 2524 25 26 27 28 2928 29 30 31 32 1

• How is the E box defined– Each row expands from

4 bits to 6 bits

Page 50: Introduction to Computer Security

50

Another View of the Mangler Function

4444444 4

6666666 6

+ + +++ ++ +

6666666 6

S8S1 S2 S7S3 S4 S5 S6

4444444 4

Permutation

The permutation produces “spread” among the chunks/S-boxes!

subkey

Page 51: Introduction to Computer Security

51

2 bitsrow

S i

i = 1,…8.

I1I2I3I4I5I6

O1O2O3O4

4 bitscolumn

an integer between0 and 15.

S-Box (Substitute and Shrink)

• 48 bits ==> 32 bits. (8*6 ==> 8 *4)• 2 bits used to select amongst 4 permutations

for the rest of the 4-bit quantity

Page 52: Introduction to Computer Security

52

The First S Box S1

0 1 2 3 4 5 6 … 15

0 14 4 13 1 2 15 11

1 0 15 7 4 14 2 13

2 4 1 14 8 13 6 2

3 15 12 8 2 4 9 1

Each row and column contain different numbers.

Example: input: 100110 output: ???

Page 53: Introduction to Computer Security

53

DES Standard

• Cipher Iterative Action– Input: 64 bits– Key: 48 bits– Output: 64 bits

• Key Generation Box– Input: 56 bits– Output: 48 bits

One round (Total 16 rounds)

Page 54: Introduction to Computer Security

54

Avalanche Effect

• A small change in either the plaintext or the key should produce a significant change in the ciphertext

• DES has a strong avalanche effect• Example

– Plaintexts: 0X0000000000000000 and 0X8000000000000000– Same key: 0X016B24621C181C32– 34 bits difference in cipher-texts– Similar result with same plaintext and slightly different keys

Page 55: Introduction to Computer Security

55

Concerns about DES

• Key space problem: 56 bit key (256)– DESCHALL recovered RSA challenge I key on June 17,

1997 (6 month into the contest)– $.25m (total cost), July 15, 1998, RSA DES challenge II key

recovered in 56 hours• Cryptanalysis

– Sixteen weak and semi-weak keys:– Differential cryptanalysis require less tries using chosen

plaintext/ciphertext [Biham, 1993]• Effective up to 15 rounds• DES is well designed to defeat differential analysis

– Linear cryptanalysis requires only known plaintext/ciphertext [Matsui, 1993]


Recommended