IT346 Information
System Security

Week 4: Cryptography
(Continue)

Faculty of Information Technology

Page
Cryptography
 Cryptography

graph

crypto

“
 Cryptography

Cryptography
”
3

‣ Symmetric Key Cryptography

Key Cryptography

‣ Asymmetric Key Cryptography

Key Cryptography

Faculty of Information Technology

Secret
Public
Page
Symmetric Key
Cryptography

Cryptography



Symmetric Key
Plaintext

(Block Cipher)
‣
• DES:
• 3DES:
• AES:

1

1 Data Block = 64 bits
1 Data Block = 64 bits
1 Data Block = 128 bits

(Stream Cipher)
‣

Faculty of Information Technology

Page
Stream Ciphers
bit


‣

 Key
‣ Keystream

bit

(Stream)

Keystream

Stream
Cipher
pseudorandom keystream
‣ Pseudorandom

Faculty of Information Technology

Page
Stream Ciphers
bit



(




Keystream
XOR)
bit
random
keystream
plaintext
plaintext

Keystream
plaintext
Key
Ci = Pi XOR StreamKeyi
encrypt

Faculty of Information Technology

Page
Stream Ciphers


Secret Key

Seed
Keystream
Key

Stream Cipher
Pseudorandom

K

Key
K

KeyStream Generator
(Pseudorandom byte
generator)

KeyStream Generator
(Pseudorandom byte
generator)

Plaintext
Byte
Stream
P

+
ENCRYPTION

Faculty of Information Technology

Ciphertext
Byte
Stream
C

+

Plaintext
Byte
Stream
P

DECRYPTION

Page
One-Time-Pad
(OTP)
 Stream Cipher

One-Time-Pad
Cipher
break

‣ Keystream

Vernam
(unbreakable cipher)

random number
Secret Key
Pseudorandom number generator
‣ Secret Key
OTP
Keystream
plaintext
OTP

Faculty of Information Technology

OTP

Page
Stream Cipher
Properties


Encryption

‣

‣ Keystream

random

Stream Cipher

random

‣ Secret Key

Brute-force Attack
bits


Faculty of Information Technology

Page
RC4
 RC4

Stream Cipher
Ron Rivest
RSA Security (Security
Company)

Key
(variable key size)
(Byte-oriented
Stream Cipher)
random permutation
 RC4
SSL/TLS
wireless WEP
Faculty of Information Technology

Page
RC4 Keystream
Generation
 RC4

state
‣

keystream

S

secret internal

:

Permutation

bytes
‣ Pointer i
j: Pointer
S

bits

 Keystream Generation
‣

Key

Faculty of Information Technology

–

S

bits
Page
Key Scheduling
Algorithm (KSA)
 KSA

S
‣

byte
for i from 0 to 255
S[i]
S[1] := i
endfor

S

S[0]
,

,

Identity Permutation

‣

for i from 0 to 255
j := (j + S[i] + key[i mod keylength]) mod 256
swap S[i] and S[j]
Permute
S
Key
endfor

Faculty of Information Technology

Page
Pseudo-Random Generation
Algorithm (PRGA)
 PRGA

Keystream

‣

keystream
Keystream

Faculty of Information Technology

byte

PRGA

Byte
encryption

Page
Pseudo-Random Generation
Algorithm (PRGA)
PRGA



pointer i

‣
‣

i

•

j

•
•
•

(S[i]
Faculty of Information Technology

S[i]

j

PRGA

S[i]

i := 0 , j := 0
S[j]
while
S[i]
S[j] :=GeneratingOutput:
i
(i + 1) mod 256
Keystream (j + S[i]) mod 256
j :=
swap S[i] and S[j]
S
+ S[j]) mod K := S[(S[i] + S[j]) mod 256]
256
output K
endwhile
Page
Pseudo-Random Generation
Algorithm (PRGA)


Faculty of Information Technology

PRGA

Page
Attack on
Cryptography
 Cryptanalysis

plaintext
break

encrypt

‣ Ciphertext-only attack

encrypt

Key

key

ciphertext

key
‣ Known-plaintext attack
plaintext
key
key
‣ Chosen-plaintext attack
Faculty of Information Technology

plaintext

ciphertext
ciphertext
Page

15
Asymmetric Key
Cryptography
(Public Key
Cryptography)

Faculty of Information Technology

Page
Asymmetric Key
Cryptography


encrypt
‣

‣
‣

symmetric key cryptography
key
decrypt
key

Key
Key
key

‣

ciphertext
Faculty of Information Technology

Symmetric Key Encryption

Page

17
Asymmetric Key
Cryptography


cryptosystem
cryptography
‣ Public Key

asymmetric key
key
key

‣ Private Key

key

Encryption


‣

public key

encrypt
Faculty of Information Technology

public key
Page

18
Asymmetric Key
Cryptography

Faculty of Information Technology

Page
Asymmetric
Encryption

 Public-Key Cryptosystem
‣
encrypt
ciphertext
decrypt
plaintext P = Plaintext
E(P, PKreceiver) = C

‣

public key
private key
encryption
decryption

‣

Plaintext
Faculty of Information Technology

E(C, SKreceiver) = P

C = Cipherte
PK = Public K
SK = Private

public key
private
Public Key key Private Key
Ciphertext
Encryp
Decryp
tion
tion

Plaintext
Page

20
Public Key
Cryptography

 Public Key Cryptography

one-way function

‣ One-Way Function

(Multiplication)
(Factorization)

‣
•

x12 = 144
•

x12

144

= 12x12 = 144x1 = 24x6, …
Faculty of Information Technology

Page

21
 RSA Algorithm
 Diffie-Hellman Algorithm (

Key Exchange)
 Elliptic Curve Cryptography
 Digital Signature Algorithm

Faculty of Information Technology

Page

22
RSA
 RSA

Adi Shamir)
Len Adleman) MIT

Faculty of Information Technology

Ron Rivest)
RSA

Page

23
RSA



(prime number) p

q
‣





gcd
‣
Faculty of Information Technology

n = pq
m = (p-1)(q-1)
e 1<e<m
e
m
e

e

m

gcd(e, m)
Page

24
RSA Encryption


M
M<n
Public Key (e, n)

‣ Ciphertext C = Me mod n

RSA Decryption

ciphertext C
(d, n)
‣ Message

Private Key

M = Cd mod n


‣ p = 5, q = 7, n = 35, m = 24

Faculty of Information Technology

Page

25
 n = 35, e = 5
Ciphertext = Me mod n

Plainte M
xt
L
12

Me

O

15

759375 15

V

22

E

5

515363 22
2
3125
10

Faculty of Information Technology

248832 17

Page

26
 n = 35, d = 29

Cd

Cipher
text

17
15
22

M= Cd
mod n

Plainte
xt

481968572106750915091411 12
82522307000
127834039488589391112327 15
57568359400

L

8.5164331908653770195619
449972111e+38

22

V

5

E

10
Faculty of Information Technology

O

Page

27

Information system security wk4-cryptography-2