Cryptography, Attacks and Countermeasures Lecture 3 - Stream Ciphers

Slides:



Advertisements
Similar presentations
Minimalism in Cryptography: The Even-Mansour Scheme Revisited Orr Dunkelman, Nathan Keller, and Adi Shamir Haifa University, Bar-Ilan University, and The.
Advertisements

Foundations of Cryptography Lecture 10 Lecturer: Moni Naor.
Xiutao Feng Institute of Software Chinese Academy of Sciences A Byte-Based Guess and Determine Attack on SOSEMANUK.
CSE 330: Numerical Methods
LINEAR FEEDBACK SHIFT REGISTERS, GALOIS FIELDS, AND STREAM CIPHERS Mike Thomsen Cryptography II May 14 th, 2012.
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
1 Lecture 3: Secret Key Cryptography Outline concepts DES IDEA AES.
Class 25: Security through Complexity? Karsten Nohl cs302: Theory of Computation University of Virginia, Computer Science PS6 is due today. Lorenz cipher.
Digital Kommunikationselektroink TNE027 Lecture 6 (Cryptography) 1 Cryptography Algorithms Symmetric and Asymmetric Cryptography Algorithms Data Stream.
Session 2: Secret key cryptography – stream ciphers – part 2.
Stream ciphers 2 Session 2. Contents PN generators with LFSRs Statistical testing of PN generator sequences Cryptanalysis of stream ciphers 2/75.
Cryptography and Network Security Chapter 3
CSCI283 Fall 2005 GWU All slides from Bishop’s slide set Stream Ciphers.
 We spoke about defense challenges  Crypto introduction o Secret key, public algorithms o Symmetric, asymmetric crypto, one-way hashes  Attacks on cryptography.
Session 2 Symmetric ciphers 1. Stream cipher definition Recall the Vernam cipher: Plaintext Ciphertext (Running) key
Introduction to Cryptography and Security Mechanisms: Unit 5 Theoretical v Practical Security Dr Keith Martin McCrea
Session 6: Introduction to cryptanalysis part 2. Symmetric systems The sources of vulnerabilities regarding linearity in block ciphers are S-boxes. Example.
Akelarre 1 Akelarre Akelarre 2 Akelarre  Block cipher  Combines features of 2 strong ciphers o IDEA — “mixed mode” arithmetic o RC5 — keyed rotations.
Secret agents leave big footprints: how to plant a trapdoor in a cryptographic function and why you might not get away with it. GECCO 2003 John A Clark,
Foundations of Network and Computer Security J J ohn Black Lecture #3 Aug 28 th 2009 CSCI 6268/TLEN 5550, Fall 2009.
CSE331: Introduction to Networks and Security Lecture 17 Fall 2002.
McGraw-Hill©The McGraw-Hill Companies, Inc., Security PART VII.
Stream Ciphers 1 Stream Ciphers. Stream Ciphers 2 Stream Ciphers  Generalization of one-time pad  Trade provable security for practicality  Stream.
Session 6: Introduction to cryptanalysis part 1. Contents Problem definition Symmetric systems cryptanalysis Particularities of block ciphers cryptanalysis.
ORYX 1 ORYX ORYX 2 ORYX  ORYX not an acronym, but upper case  Designed for use with cell phones o To protect confidentiality of voice/data o For “data.
Session 2: Secret key cryptography – stream ciphers – part 1.
Computer Security CS 426 Lecture 3
Cryptanalysis. The Speaker  Chuck Easttom  
EE5552 Network Security and Encryption block 4 Dr. T.J. Owens CEng MIET Dr T. Itagaki MIET, MIEEE, MAES.
Cryptanalysis of Modern Symmetric-Key Block Ciphers [Based on “A Tutorial on Linear and Differential Cryptanalysis” by Howard Heys.] Modern block ciphers.
Block ciphers 2 Session 4. Contents Linear cryptanalysis Differential cryptanalysis 2/48.
Códigos y Criptografía Francisco Rodríguez Henríquez A Short Introduction to Stream Ciphers.
Cryptography, Attacks and Countermeasures Lecture 4 –Boolean Functions John A Clark and Susan Stepney Dept. of Computer Science University of York, UK.
CS1Q Computer Systems Lecture 8
Differential Cryptanalysis - quite similar to linear cryptanalysis - exploits the relationship between the difference of two inputs and the difference.
One-Time Pad Or Vernam Cipher Sayed Mahdi Mohammad Hasanzadeh Spring 2004.
CS555Spring 2012/Topic 51 Cryptography CS 555 Topic 5: Pseudorandomness and Stream Ciphers.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Analysis of Algorithms
Stream Ciphers Making the one-time pad practical.
Section 2.1: Shift Ciphers and Modular Arithmetic Practice HW from Barr Textbook (not to hand in) p.66 # 1, 2, 3-6, 9-12, 13, 15.
Session 1 Stream ciphers 1.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CRYPTANALYSIS OF STREAM CIPHER Bimal K Roy Cryptology Research Group Indian Statistical Institute Kolkata.
PRBG Based on Couple Chaotic Systems & its Applications in Stream- Cipher Cryptography Li Shujun, Mou Xuanqin, Cai Yuanlong School of Electronics & Information.
Cyclic Redundancy Check CRC Chapter CYCLIC CODES Cyclic codes are special linear block codes with one extra property. In a cyclic code, if a codeword.
DIFFERENTIAL CRYPTANALYSIS Chapter 3.4. Ciphertext only attack. The cryptanalyst knows the cryptograms. This happens, if he can eavesdrop the communication.
Linear Feedback Shift Register. 2 Linear Feedback Shift Registers (LFSRs) These are n-bit counters exhibiting pseudo-random behavior. Built from simple.
Great Theoretical Ideas in Computer Science.
1 Prune-and-Search Method 2012/10/30. A simple example: Binary search sorted sequence : (search 9) step 1  step 2  step 3  Binary search.
Introduction to Modern Symmetric-key Ciphers
Lecture 23 Symmetric Encryption
Bhupendra Singh Bhupendra Singh Scientist ‘B’ Scientist ‘B’ Centre for Artificial.
K. Salah1 Cryptography Module I. K. Salah2 Cryptographic Protocols  Messages should be transmitted to destination  Only the recipient should see it.
Block Ciphers and the Advanced Encryption Standard
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
DES Analysis and Attacks CSCI 5857: Encoding and Encryption.
1 The Data Encryption Standard. 2 Outline 4.1 Introduction 4.4 DES 4.5 Modes of Operation 4.6 Breaking DES 4.7 Meet-in-the-Middle Attacks.
Key Stone Problem… Key Stone Problem… Set 17 Part 2 © 2007 Herbert I. Gross next.
Slide 1 Vitaly Shmatikov CS 378 Stream Ciphers. slide 2 Stream Ciphers uRemember one-time pad? Ciphertext(Key,Message)=Message  Key Key must be a random.
Information and Network Security Lecture 2 Dr. Hadi AL Saadi.
หัวข้อบรรยาย Stream cipher RC4 WEP (in)security LFSR CSS (in)security.
Cryptography Lecture 15.
Objective of This Course
PART VII Security.
Introduction to Modern Symmetric-key Ciphers
ECE 352 Digital System Fundamentals
Information and Computer Security CPIS 312 Lab 4 & 5
Presentation transcript:

Cryptography, Attacks and Countermeasures Lecture 3 - Stream Ciphers John A Clark and Susan Stepney Dept. of Computer Science University of York, UK {jac,susan}@cs.york.ac.uk

Stream Ciphers Part I: Pseudo-random number generators. Lots of Bad Ways Part II: Divide and conquer attacks.

Stream Ciphers - Vernam Vernam Cipher works by generating a random bit stream and then XORing that stream on a bit by bit basis with the plaintext. Key K Key K Random Stream Bi Random Stream Bi Bi Bi Pi Ci Pi Both sender and receiver can generate key stream Bi. Receiver XORs the ciphertext stream with the key stream to recover the plaintext stream. We will use this cipher to illustrate several concepts.

Linear Feedback Shift Registers 1 1 Lij 1 1 1 At each iteration there is a right shift, a bit falls off the end, and the leftmost bit is set according to the linear feedback function. Here 0+0+1=1

Periodicity We would like the stream to be ‘random-looking’. One feature should be that the stream should not repeat itself too quickly. Note that this is in effect a finite state machine and so must repeat itself eventually. The maximal period for an n-bit register is 2n-1. Why not 2n ?

Maximal Period m-sequences The tap sequence defines the linear feedback function and is often regarded as a finite field polynomial. You have to choose the tap sequence very carefully. Some choices provide a maximal length period. These are primitive polynomials

Primitive Polynomials Give m-sequences D3 D2 D1 D0 1 2 3 4 5 6 7 t D3 D2 D1 D0 8 1 9 10 11 12 13 14 15 1 1 Common to denote the above by the polynomial C(D)=1+D+D4. Note we are back to where we started.

Some Polynomials Don’t 1 2 3 4 5 6 7 t D3 D2 D1 D0 8 1 9 10 11 12 13 14 15 1 1 The polynomial C(D)=1+D+D3 does not give a maximal period sequence.

Not good for PRNG Consider a 64 bit register. Can this be used as a key stream generator? No. Once you know a very small amount of plaintext (e.g. 32 consecutive bits) then you can calculate the corresponding key stream and so you know the rightmost 32 bits in the register. You can now try in turn all other 232 combinations for the rest. When you get the right one, you are able to generate the whole key stream And so plaintext should make sense. This is just too easy to break. But LFSRs are very easy to implement; and execute quickly. Can we fix matters? How about a less primitive way of extracting the key stream. How about combining several streams to achieve any better security?

Very Simple Model LFSR 1 f Zj Use some function f to operate on some subset of the LFSR register components f Zj

Boolean Functions – Algebraic Normal Form (ANF) A Boolean function on n-inputs can be represented in minimal sum (XOR +) of products (AND .) form: This is the algebraic normal form of the function. The algebraic degree of the function is the size of the largest subset of inputs (i.e. the number of xj in it) associated with a non-zero co-efficient. 1 is a constant function (as is 0) x1+x3+x5 is a linear function x1.x3+x5 is a quadratic function x1.x3.x5+x4x5+x2 is a cubic function f(x1,…,xn)=a0+a1. x1 +…+an. xn+ a1,2.x1.x2+…+ an-1,n.xn-1.xn+… …+a1,2,..,n x1.x2 ...xn

Very Simple Model What about a linear function f? LSFR 1 f Zj

Very Simple Model 1 This would be pretty awful. Suppose we know a sequence of keystream bits z0, z1 , z2, z2 ,…=1, 1, 1, 1,… Essentially every key stream output can be expressed as a linear function of the elements of the initial state. We can derive a number of these equations and then solve them by standard linear algebra techniques.

Very Simple Model XORed to give feedback z0= s0 +s2 z1= s1 +s3 s0 +s1 +s3 s0 +s1 +s2 +s3 s0 +s1 +s3 s0 +s1 +s2 z0= s0 +s2 z1= s1 +s3 z2= s2 +s0 +s3 z3= s3 +s0 +s1+s3 = s0 +s1

Very Simple Model We can apply linear algebra equation solving techniques and solve for the si. z0= s0 +s2 z1= s1 +s3 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0 z2= s2 +s0 +s3 s0 s1 s2 s3 1 1 1 1 z0 z1 z2 z3 z3= s3 +s0 +s1+s3 = s0 +s1 This has solution s0 s1 s2 s3 0 1 1 0 1 1

Harder Model LSFR 1 f Zj What about a non-linear function f This is better but it is still possible to attack such systems if f is approximated by a linear function. We will talk about approximations later.

Classical Stream Cipher Model Plaintext Stream Pj Keystream Zj Cipherstream Cj LSFR 1 L1j LSFR 2 L2j Combining Boolean function f. f Zj Receiver can generate key stream and recover plaintext LSFR n Choose f very carefully Lnj N- Bit registers Initial register values form the ‘key’ Cj Pj

Periodicity The LFSRs need not all be the same length. The LFSRs will give a vector input which has period that is the product of the least common multiple of the periods of each of the LFSRs. E.g. if period LFSR1=3,LFSR2=7 then overall period is 21

Awful Choice for f LSFR 1 x1j Zj=f(x1j , x2j)= x1j f Zj LSFR 2 x2j Cj This is a truly awful choice. The key is intended to be 2 x 32 = 64 bits. x1j Zj=f(x1j , x2j)= x1j f You have completely ignored LFSR 2. Key size = 32 bits only Zj LSFR 2 x2j 32- Bit registers Initial register values form the ‘key’ Cj Pj

Better but Still Awful Choice for f LSFR 1 Congratulations! You have not ignored LFSR 2! Key size = 64 bits? x1j Zj=f(x1j , x2j) = x1j x2j + f Zj LSFR 2 x2j 32- Bit registers Initial register values form the ‘key’ Cj Pj

Better but Still Awful Choice for f Well not quite such a good choice. Suppose you know 32 consecutive bits of plaintext (or can guess them correctly). Calculate the 32 bits of key stream. But if stream bit is 0 then there are only 2 possible pairs. Similarly, if stream value is 1. Effective key size = 232 x32 x31 x30 x2 x1 xk yk + = + = 1 + = or + + + + + y32 y31 y30 y2 y1 = = = = = 1 1 1

First Bit of Bad Linearity The combination function here is a linear function of the inputs: f(x1,x2)=x1 f(x1,x2)=x2 f(x1,x2)=x1+x2 The following are quadratic functions: f(x1,x2)=x1.x2 + x1 f(x1,x2)= x1.x2 + x2 f(x1,x2)= x1.x2 + x1+x2 Extreme examples given but beware linearity - even a hint of it can spell trouble. linear functions are so called because they can cause some cryptosystems to be broken straight away??    

Divide and Conquer Attacks Exploiting simple correlations in the combining function

Geffe Generator LSFR 1 a1j LSFR 2 b2j LSFR 3 c3j Zj select 2x1 Multiplexor b2j LSFR 3 c3j Zj Z=(a & b) + (not(a) & c)

Geffe Generator – DIVIDE AND CONQUER Looking at the table it is clear that the output z agrees with b 75% of the time. Also agrees with c 75% of the time. a b c z 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1

Geffe Generator – DIVIDE AND CONQUER So consider each possible initial state s of register LFSR2. Determine the LFSR2 stream that s produces. Check the degree of agreement of this stream with the actual key stream. Turns out: if state s is correct you will get roughly the right amount of agreement. if state s is incorrect you will get roughly random (50%) agreement. Thus we have targeted LFSR2 and can easily break it. Now can target LFSR3 in exactly the same way. So we can get LFSR2 and LFSR3. Now we can derive the selection LFSR1 state very straightforwardly: try every possible state. The correct one should allow you to simulate the whole sequence. Other ways too.

Divide and Conquer Divide and conquer attacks were suggested by Siegenthaler as a means of exploiting approximate linear relationships between function inputs and its output. This led to new criteria being developed as countermeasures to these correlation attacks. We will consider an extremely simple example.

Divide and Conquer Consider the following combining function f(x1,x2)=x1.x2+x1 Clearly not linear. But… f(x1,x2) agrees with x1 75% of the time here. Consider each possible initial state of LFSR1 and determine the degree of agreement with the actual key stream. The correct initial state will give approximately 75% agreement and the rest will give fairly random agreement. It’s also obvious that if we know f(x1,x2)=1 then we know both x1 and x2 => this is simply due to the incredibly small nature of the example. x1 x2 f(x1,x2) 0 0 0 0 1 0 1 0 1 1 1 0

Divide and Conquer Consider two functions f(x1,x2) and g(x1,x2) We say that f(x1,x2) is approximated by g(x1,x2) if the percentage of pairs (x1,x2) which given the same values for f and g differs from 50%. If they agree precisely half the time we say that they are uncorrelated. Note: if the percentage of agreement is less than 50% we can always find a function that has positive agreement, namely g(x1,x2)+true.

Ideas Generalise We can consider similar ideas for n-input functions: f(x1,x2,…,xn); and g(x1,x2,…,xn) Degree of approximation with linear functions may be slight. The smaller the degree of approximation the more data you need to have to break the system.

And then what? The idea of multiple LFSRs is that the size of the keyspace should be the product of the keyspace sizes for each register. Divide and conquer reduces this to a sum of key sizes and you attack each in turn. Note what happens when you crack one LFSR. The complexity of the remaining task is reduced: f(x1,x2)=x1.x2+x1 Once you know x1 then the task for x2 is simpler – whenever you know x1=1 you know what x2 is.

All Fall Down In a similar vein, suppose: There is a small exploitable correlation with input x1. There is a small correlation with x1+x2. If LFSR 1 can be broken to reveal x1 then we have now have a straightforward correlation with x2 to exploit.

Don’t tell them But what if you don’t publicise the taps sequence – keep the feedback polynomial secret (as part of the key). Makes things harder but there are in fact some further attacks here too.

Summary Have presented some very simple stream cipher models. Divide and conquer attacks. Dangers of linearity and hints of it. Next lecture: What do we do about the dangers? Boolean function criteria. High non-linearity. High algebraic degree. Correlation immunity. Tradeoffs between them.

Lectures begin at 14.20.