Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of Malawi, Chancellor College

Similar presentations


Presentation on theme: "University of Malawi, Chancellor College"— Presentation transcript:

1 University of Malawi, Chancellor College
Cryptography Hyunsung Kim, PhD University of Malawi, Chancellor College Kyungil University February, 2016

2 Contents 10. Modern Stream Ciphers 10.1 RC4
10.2 Self-Synchronizing Stream Ciphers 10.3 One-Time Pads 10.4 A5/1

3 Modern Stream Ciphers They encrypt individual characters (usually binary digits) of a plaintext message one at a time Stream ciphers are generally faster than block ciphers Stream ciphers may be advantageous in situations where transmission errors are highly probable because they have limited or no error propagation Cipher algorithms RC4 Self synchronizing stream ciphers One time pads A5

4 Modern Stream Ciphers Stream Cipher Structure state (data) Key
Randomness of stream key completely destroys statistically properties in message Must never reuse stream key. Otherwise can recover messages state (data) Key next state function output function KSi Plaintexti Ciphertexti

5 Modern Stream Ciphers Plaintext is a stream of bytes : P1, P2, P3, …
Use a key K as the seed to generate a sequence of pseudorandom bytes (keystream) : KS1, KS2, KS3, … Ciphertext is C1, C2, C3, …, where Ci = Pi  KSi Various stream ciphers differ in the way they generate keystreams Key output function state Plaintexti Ciphertexti KSi next state

6 Security Used between a Wireless Access Point and Wireless Ethernet Cards Existing security consists of two subsystems An authentication algorithm called Shared Key Authentication A data encapsulation technique called Wired Equivalent Privacy (WEP) Goals Create the privacy achieved by a wired network Simulate physical access control by denying access to unauthenticated stations

7 WEP Encapsulation WEP encapsulation summary 802.11 Hdr Data
Encapsulate Decapsulate Hdr IV Data ICV WEP encapsulation summary A master key shared between the end points Encryption algorithm = RC4 Per-packet encryption key = 24-bit IV concatenated to a master key WEP allows IV to be reused with any frame Data integrity provided by CRC-32 of the plaintext date (the “ICV”) Data and ICV are encrypted under the per-packet encryption key

8 RC4 The most widely used stream cipher Ron Rivest invented in 1987
The RC stands for Ron’s code Property Variable key size Byte oriented stream cipher Widely used – web Secure Socket Layer (SSL)/TLS, wireless Wired Equivalent Privacy (WEP) Normally uses 64 bits and 128 bits key sizes Consists of 2 parts Key Scheduling Algorithm (KSA) Pseudo-Random Generation Algorithm

9 RC4 + Block diagram Secret Key RC4 Key Stream Plaintext Ciphertext … …
... Plaintext ... Ciphertext +

10 RC4

11 RC4 State and Key Initialization Choose n, a positive integer (ex) n=8
Let l=(length of plaintext in bits/n) Key array K[0], K[1], …, K[2n-1] whose entries are n-bit strings Enter the key into array K[i] and repeat the key as necessary to fill the array Permutations are stored in an array S[0], S[1], …, S[2n-1] consisting of integers from 0 to 2n-1, where S[0]=0, S[1]=1, …, S[2n-1]=2n-1

12 RC4 Initial State Permutation
It uses the secret key K[i] to scramble the array S[i] Algorithm int i, j = 0; for(i=0; i<256; i++){ j = ( j + S[i] + K[i] ) % 256; swap(S[i], S[j]); }

13 RC4 State Permutation for Key Stream Generation
Scrambled S[256] array is used to generate l keystreams Algorithm i = j = 0; for(r=0; r<l; r++){ i = ( i + 1) % 256; j = ( j + S[i] ) % 256; swap( S[i], S[j] ); keystream[r] = S[ (S[i] + S[j]) % 256 ] }

14 RC4 (example) Choose n=3 Key is 0110011000011012 Plaintext is “hsk”
Plaintext is “hsk” h => 6816, s => 7316, k => 6B16 Set l=(length of plaintext in bits/n) l=(3*8)/3) =8

15 RC4 (example) Key is 314157 Plaintext is “hsk”=320715537
State and Key Initialization n=3 l=8 Key array K[0], K[1], …, K[23-1] K[0]=3, K[1]=1, K[2]=4, K[3]=1, K[4]=5 and repeat the key as necessary to fill the array K[5]=3, K[6]=1, K[7]=4 Permutation array S[0], S[1], …, S[23-1] S[0]=0, S[1]=1, S[2]=2, S[3]=3, S[4]=4 …, S[7=(23-1)]=7

16 RC4(example) Key is Plaintext is “hsk”= K[0]=3,K[1]=1,K[2]=4,K[3]=1,K[4]=5,K[5]=3,K[6]=1,K[7]=4 S[0]=0,S[1]=1,S[2]=2,S[3]=3,S[4]=4 …, S[7]=7 Initial State Permutation int i, j = 0; for(i=0; i<7; i++){ j=(j+S[i]+K[i])%8; swap(S[i], S[j]); } i j S[0] S[1] S[2] S[3] S[4] S[5] S[6] S[7] 3 1 5 2 3 3 6 j=(5+S[2]+K[5])%8 j=(3+S[1]+K[3])%8 j=(0+S[0]+K[0])%8 4 7 j=(5+2+3)%8=2 j=(3+1+1)%8=5 j=(0+0+3)%8=3 7 6

17 RC4(example) Key is Plaintext is “hsk”= K[0]=3,K[1]=1,K[2]=4,K[3]=1,K[4]=5,K[5]=3,K[6]=1,K[7]=4 S[0]=3,S[1]=5,S[2]=0,S[3]=1,S[4]=7,S[5]=6,S[6]=4,S[7]=2 State Permutation for Key Stream Generation i=j=0; for(r=0; r<8; r++){ i=(i+1)%8; j=(j+S[i])%8; swap(S[i], S[j]); t=(S[i]+S[j])%8; keystream[r]=S[t] } i j t ks S[0] S[1] S[2] S[3] S[4] S[5] S[6] S[7] 1 5 3 1 2 5 5 3 6 5 4 5 7 2 5 4 7 2 j=(0+S[1])%8 6 5 1 6 j=(0+5)%8=5 7 7 4 7 t=(S[1]+S[5])%8 2 5 t=(6+5)%8=3

18 RC4(example) Key is 314157 Plaintext is “hsk”=320715537
K[0]=3,K[1]=1,K[2]=4,K[3]=1,K[4]=5,K[5]=3,K[6]=1,K[7]=4 S[0]=3,S[1]=5,S[2]=0,S[3]=1,S[4]=7,S[5]=6,S[6]=4,S[7]=2 Key is Plaintext is “hsk”= Ciphertext Ci = Pi  Keystreami C0 = P0Keystream0 = C1 = P1Keystream1 C2 = P2Keystream2 = 00 = 000000 = 000 = 0 C3 = P3Keystream3 = 72 = 111010 = 101 = 5 C4 = P4Keystream4 = 12 = 001010 = 011 = 3 C5 = P5Keystream5 = 56 = 101110 = 011 = 3 C6 = P6Keystream6 = 57 = 101111 = 010 = 2 C7 = P7Keystream7 = 35 = 011101 = 110 = 6 i j t ks S[0] S[1] S[2] S[3] S[4] S[5] S[6] S[7] = 1 5 3 1 31 = 011001 = 010 = 2 2 5 5 = 20 = 010000 = 010 = 2 3 6 5 4 5 7 2 5 4 7 2 6 5 1 6 7 7 4 7 2 5

19 RC4 Show Block Diagram for Decryption
Decrypt by using Key with

20 Self-synchronizing Stream Cipher
When you simply XOR the plaintext with the keystream to get the ciphertext, that is called a synchronous stream cipher Eve might get a hold of a matched plaintext/ciphertext pair and find part of the keystream and somehow find the whole keystream IV IV Key Key Ciphertext Plaintext Plaintext

21 Self-synchronizing Stream Cipher
Self-synchronizing stream cipher uses old plaintext to encrypt also ci = pi  ki  pi-2 if pi-1 = 0 pi-3 if pi-1 = 1 Initially p-1 = p0 = 0 IV IV Key Key Plaintext Ciphertext Plaintext pi-1 pi-1 pi-2 pi-2 pi-3 pi-3

22 Self-synchronizing Stream Cipher
Example Plaintext : Go Keystream : =47 6F16 = IV IV Key Ciphertext Plaintext pi-1 pi-1 pi-2 if pi-1 = 0 pi-3 if pi-1 = 1 pi-2 pi-2 pi-3 pi-3

23 One-time Pads Fix the vulnerability of the mono-alphabetical substitution cipher by encrypting letters in different locations differently Key is a random string that is at least as long as the plaintext Encryption is similar to shift cipher Invented by Vernam in the 1920s Requires the following to be added to a message A truly random number string As long as the message Pad is used once and destroyed

24 One-time Pads

25 One-time Pads Let Zm={0,1,…,m-1} be the alphabet
Plaintext P = (p1 p2 … pn) Key K = (k1 k2 … kn) Ciphertext C = (c1 c2 … cn) Encryption C = (p1k1 p2k2 … pnkn) mod m Decryption P = (c1k1 c2k2 … cnkn) mod m

26 A5/1 Used in Global System for Mobil Communications (GSM)
Example of a cipher manufacturers tried to keep secret, it was leaked and also reversed engineered within 5 years A5/1 produces 228 bits to XOR with the frame One 228 bit frame is sent every 4.6 milliseconds: 114 bits for the communication in each direction Initialized using a 64-bit key combined with a publicly-known 22-bit frame number A5/1 is based around a combination of three LFSRs with irregular clocking

27 A5/1 Block Diagram x19 + x5 + x2 + x + 1 (clock bit 8 )

28 A5/1 Initialization Registers set to all 0’s
Incorporate the key and frame number: For 64 cycles, the key is mixed in by XORing the ith key bit with the least significant bit of each register For 22 cycles, the 22 bit frame value is mixed in – same as with key value Normal clocking used 100 cycles are run using the majority clocking, the output is discarded End result is the initial state


Download ppt "University of Malawi, Chancellor College"

Similar presentations


Ads by Google