You are on page 1of 26

Cryptography and Network Security

Third Edition
by William Stallings
Lecture slides by Lawrie Brown

:
.

Fahdalqasem.blogspot.com
fhdalqasem@yahoo.com

ibbalyaum.net
fahdalqasem.blogspot.com

-----------
----
-----------

---
-------
-------------
--------------
----------
MD5,SHA-1 full
-- - -dss ---------
Kerbrose5

--------
: introduction


: computer security
/.
: network security .
: internet security
.
.
: security service .
.
/.
:
)( .
: security mechanism
.
.
: ) (
.
: security attack .
.
):(x.800
:Authentication / / .
: access control / .
: data Confidentiality .
:data integrity
/ .authorized

:Non-repudiation / .
:

.
)(: )(.
:. : passive attacks
:
.
. / : active attacks
:
/ .
:
-

:
:plaintext /.
ciphertext . :cipher .
:key .
) :encipher (encrypt )(.
) :decipher (decrypt .
:Cryptography /.
) :cryptanalysis (codebreaking / :
.
:cryptology cryptography .cryptanalysis

Symmetric Cipher Model


Symmetric Cipher : .
.
:Cryptography

ibbalyaum.net
fahdalqasem.blogspot.com

:
. .
. ) (.
. :/ .
Cryptanalytic Attacks :
: ciphertext only
.
known plaintext
.
chosen plaintext
.
chosen ciphertext
.
chosen text

.
:
Block Ciphers and the Data Encryption Standard
/ ) (stream / ):(block
* .
* .
* .
):Data Encryption Standard (DES
NBS .NIST
.
.......
:DES Encryption

Initial Permutation
.

: DES Round Structure


.
:
:
Li = Ri1
)Ri = Li1 xor F(Ri1, Ki
E
.

.

DES Round Structure


: Substitution Boxes
) (


.
.
S(18 09 12 3d 11 17 38 39) = 5fd25e03 :
:DES sub keys generating

.
) (pc1 permutation choice1

.
:
.
pc2 .

.k

ibbalyaum.net
: DES Decryption
fahdalqasem.blogspot.com


.
:
Finite Fields

: group )
( ) ( :
)(a.b).c = a.(b.c
associative law:
e.a = a.e = a has identity e:
a.a-1 = e
has inverses a-1:
a.b = b.a .abelian group
cyclic group
:
a b = ak b .k
: Ring ) ( :
abelian group .
associative distributive :
a.(b+c) = a.b + a.c
.commutative ring
) ( / integral
.domain
:Field :
)(.
)( .
.
: Modular Arithmetic
mod :
a mod n a .n
a=b mod n a,b n :
. 5=17 mod 12
a=b mod n a = qn + b 0 <= b <= n-1
modulo n
mod.
:(Modulo 7 Example)
...
-21 -20 -19 -18 -17 -16 -15
-14 -13 -12 -11 -10 -9 -8
-7 -6 -5 -4 -3 -2 -1
0 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 32 33 34
...

divisors
b a m a = m . b :
a b . .b!a ,,,,,,,
.
:Modular Arithmetic Operations
/
.
:
}Zn = {0, 1, , n-1
. ):(Z8 , +

): Greatest Common Divisor (GCD


GCD a , b
)( ) GCD(60,24 .
: Euclid's GCD Algorithm
GCD :
.
)GCD ( a , b) = GCD (b , a mod b
GCD
) GCD(, ) GCD(, 80 mod7= 3
...
:
A=a, B=b
while B>0
R = A mod B
A = B, B = R
return A
: Galois Fields
.
finite fields
Pn ) GF(Pn :
)GF(p
)GF(2n
) GF(p p-1 .p
)
( .
) * :(FG(7),

ibbalyaum.net
fahdalqasem.blogspot.com

:
:

.
, :
eg. let f(x) = x3 + x2 and g(x) = x2 + x + 1
f(x) + g(x) = x3 + x + 1
f(x) x g(x) = x5 + x2
) GF(2n .
:
Confidentiality Using Symmetric Encryption
Key Distribution
symmetric .
.
.
:
. .
. .
. .
.
.
Key Distribution Scenario

Key Distribution ) (
. authentication steps

Key Distribution Scenario


: Key Distribution Issues
.
session key
.. .
:
Introduction to Number Theory
: Prime Numbers
integer numbers
,,, .
.
: Prime Factorisation
n n=a
. b c
:
91=713 3600=243252
: Relatively Prime Numbers
) (
) (,..
) (,,, .
:Fermat's Theorem
p GCD a a , p
:
p-1
a mod p = 1
.
): Euler Totient Function (n
n n-1 n-1
)( / .n
n ).(n
n n:
n (n)=n-1
n = p . q )(n)= (p.q)= (p-1)(q-1
.
:
) (37) = 36 , (37 is a prime
) (21) = (31)(71) = 26 = 12 , (21= 3 * 7
:Euler's Theorem
:
)(n
a mod N = 1 ,where GCD ( a , N ) = 1..
:
; a=3;n=10; (10)=4
hence 34 = 81 = 1 mod 10
ibbalyaum.net

fahdalqasem.blogspot.com

; a=2;n=11; (11)=10
hence 210 = 1024 = 1 mod 11
: RSA
Public Key Cryptography and RSA
:private Key Cryptography

.
: Public Key Cryptography

.
.
// public-key/two-key/asymmetric
:
: KU .
: KR / .
asymmetric
.
.

:
:
:key distribution /
.
: digital signatures
.
.
:
:
. .
. .
. .
:

:
:
: .
: / .
: .
.
:
.
) (.
.

.
.
) RSA (:

) (
.
:RSA
:
. P .q
. N :
N = p . q ) ).( ( N ) = ( p - 1 ) ( q - 1
.
N e ) ( N
e ) ( N
) . ( N :
)where 1<e<(N), GCD(e,(N))=1
. d
:
ibbalyaum.net
e . d = 1 mod ( N ) and 0 d N

fahdalqasem.blogspot.com

. } KU={e,N KU
.
.
} KR={d,p,q KR .
RSA Use
M } KU={e,N C
:
e
C = M mod N, where 0<= M < N.
M block
.
C
) ( N
N ) ( N p,q
.
} KR={d,p,q M :
d
M=C mod N
:RSA
:
)(n
a mod N = 1 ,where GCD ( a , N ) = 1.
:
) N = p . q and (N) = ( p 1 ) ( q 1
e d ) (mod (n)) (n
:
e . d = 1 + k . ( N ) ,for some k
e d ) ((N) , + , . :

Cd = (Me)d = M1+k.(N) = M1.(M(N))k = M1.(1)k = M1 = M mod N

Select primes: p=17 & q=11


Compute n = pq =1711=187
Compute (n)=(p1)(q-1)=1610=160
Select e : gcd(e,160)=1; choose e=7
Determine d: de=1 mod 160 and d < 160 Value is d=23 since 237=161= 10160+1
}Publish public key KU={7,187
}Keep secret private key KR={23,17,11

:
Key Management; Other Public Key Cryptosystems
:Distribution of Public Keys
:
. Public announcement
. Publicly available directory
. Public-key authority
. Public-key certificates

:


.
:

:

.
.
:

/ ) (
) (real-time .

Public-Key Authority

:

!
) (
.

ibbalyaum.net
fahdalqasem.blogspot.com

Public-Key Certificates

.
:


)
( .
Simple Secret Key Distribution
....
.
Diffie-Hellman Key Exchange

.
:
.
.
.
.
) (
.
) (
) (RAS .
:
) ( q .
/ .q
) q A xA
(xA<q yA ).(yA = xA mod q
A yA B yB KAB:
) ( KAB = yA yB mod q = xA.xB mod q
)KAB = yAxB mod q (which B can compute

)KAB = yBxA mod q (which A can compute


KAB /.
.
xA xB
.
:
A B q :
q=353 , =3
A q xA=97 B .. xB=233
:
(A) yA=397 mod 353 = 40
(B) yB=3233 mod 353 = 248
KAB:
KAB= yBxA mod 353 = 24897 mod 353 = 160
)(A
KAB= yAxB mod 353 = 40233 mod 353 = 160
)(B
) ( .
: /
Message Authentication and Hash Functions
): Message Authentication Code (MAC
/
.
) (MAC .
MAC
.
.

Message Authentication Code


confidentiality
.
.
.
.. .MAC
MAC ) (.
MAC digital signature
ibbalyaum.net
.

fahdalqasem.blogspot.com

:MAC
: checksumMAC = CK(M) , where M is the message
. . .to a fixed-sized authenticator ) ( .many-to-one function . :MAC
MAC :
( ) ( .
( / .
( )( .
:
.
) Data Authentication Algorithm (DAA
.DES-CBC

)(zero-pad of final block DES CBC
.
.
/ : Hash Functions


.
: Hash Function Properties
:)h = H(M
M . .
.
.
.
.
.
.

: Requirements for Hash Functions


.
.
M ). h = H(M
h M ) . (
) H(y)=H(x x .y
) H(y)=H(x x .y

MD5,SHA-1 full
-- - -DSS ---------
Kerbrose5

--------

: Hash Algorithm
:
block cipher
brute-force
.plaintext
MD4 , MD5, SHA1 , RIPEMD160 :
.
) ( :message digest MD5
.RAS
MDn MD2 .MS4
)( .
.
).(RFC 1321
:MD5
padding
.
buffer MD5 ).(A,B,C,D

MD5 Overview
) (compression function
.
buffer ) (IV0: ini al value

ibbalyaum.net
fahdalqasem.blogspot.com

)
(.
) (digest MD5 .pad message
) (digest ) (integrity.
:MD5 Compression Funcon

round1 round2
.
:
)]b=b+(( a+ g(a,c,d) + X[k] + T[i
a,b,c,d
.
) g(a,c,d g
).(f,g,h,i

] x[k ] T[i .sin

MD5 Compression Funcon


:MD5
. . . ):Secure Hash Algorithm (SHA-1
SHA NIST & NSA .SHA-1
.DSA / . - .

MD4 . :SHA-1
MD5 padding . ) ( . initial value ) ( :
).(mixing & shifting buffer. . :SHA-1
) (MD5 ) (SHA-1
) (
.
5 buffers
:
)(A,B,C,D,E) <-(E+f(t,B,C,D)+(A<<5)+Wt+Kt),A,(B<<30),C,D
a,b,c,d t
.
) f(t,b,c,d wt
kt .

SHA-1 Compression Function


):(SHA-1 vs. MD5
brute force SHA-1 MD5 ) (.
. ) ( ) : MD5 (.
- .

ibbalyaum.net
:
fahdalqasem.blogspot.com

Digital signature and authentication protocols


:
. MAC.
.
.
. .
. .
. ) (infeasible
:
.i .
.ii .
. .
:
.
.

) ( .
.
.
.
:
arbiter :A
.
.
.
.
.
:
/ .
) ( .

.
:
.
.
/ .
: Using Symmetric Encryption
.
KDC :
KDC.
KDC .
master keys .

-:
.
A B .KDC
:
1. AKDC: IDA|| IDB|| N1
2. KDCA: EKa[Ks|| IDB|| N1 || EKb[Ks||IDA] ]
3. AB: EKb[Ks||IDA]
]4. BA: EKs[N2
])5. AB: EKs[f(N2
.
.
) ( .
:digital signature standard DSS
.
.SHA
.NIST&NSA
.
.
: DSA Key Generation DSA
):(p,q,g
L
p .p= 2 :
L .
q .p1
g :
(p1)/q
(p1)/q
where h<p1, h
(mod p) > 1
g=h
x : y
:
x<q
X
)y = g (mod p
:
M :
k .k<q
r,s:
k
) r = ( g (mod p) ) ( mod q
) s = ( k1 .SHA ( M ) + x.r ) ( mod q
) (r,s .M

ibbalyaum.net
fahdalqasem.blogspot.com


: DSA Signature Verification
M r . s
) (:
)w = s1(mod q
)u1= (SHA(M).w)(mod q
)u2= (r.w)(mod q
)v = (gu1.yu2(mod p)) (mod q
if v=r then signature is verified
r v
.
r v .
:
Authentication Applications
:KERBEROS
.MIT
.
.
.
KERBEROS 4 : KERBEROS 5
:
. . . . -.

: Kerberos Version 5
:
.
:
:

.
:
.
.RFC 1510
:
1) C As : IDc || Pc || IDv .
2) As C : Ticket.
3) C As : IDc || Ticket.
where:
]Ticket = Ekv[IDc || ADc || IDv
C = client
As = server of authentication
IDc = identifier of user on C
IDv = identifier of user on V
Pc = password of C
ADc = Netowork address of C
Kv = security key shard by As & V
|| concatenation

ibbalyaum.net
fahdalqasem.blogspot.com

: Web Security
): Secure Electronic Transactions (SET
.
) (credit card .
.
.
:
.
. x.509v3
.

SET Components
: SET
. .credit card
. .certificate
. .
. .
. ) (certificate server .
. .
. .
. .
. .
. .
: dual signature
OI
PI .
.
.
ibbalyaum.net

fahdalqasem.blogspot.com

PI OI
.
:
DS = Ekr[ H(PI) || H(OI) ] POMD
PIMD Payment Order Message Digest
.


:
.

You might also like