Chapter-3 Computer Security
Chapter-3 Computer Security
Verification algorithm
ElGamal Signature Example
ElGamal Signature Algorithm
to sign a message M=5
ϗ choose random k=9
ϗ confirm gcd(10,9)=1
ϗ compute: r = gk mod p
= 29 mod 11
=6
ϗ solve: m=sk+xr (mod(p-1)), that is,
5 = 8*6+9*S mod 10; but 9-1 = 9 mod 10; hence S = (5-
8*6)*9-1 =3 mod 10
ϗ signature pair is (r=6, S=3)= (6,3)
ϗ The signed message is (5,(6,3))
The Diffie-Hellman Algorithm(DH)
ϗ Discovered by Whitfield Diffie and Martin Hellman
ϗ Security of transmission is critical for many network and
Internet applications
DH
ϗ Allows two users to exchange a secret key
ϗ Requires no prior secrets
ϗ Applicable over an untrusted network
ϗ Based on the difficulty of computing discrete logarithms of
large numbers.
ϗ No known successful attack strategies*
ϗ Requires two large numbers, one prime (P), and g, a
primitive root of P
ϗ Requires users to share information in a way that others
can’t decipher the flow of information
Continued
ϗ P and g are both publicly available numbers
ϗ P is at least 512 bits
ϗ Users pick private values a and b
ϗ Compute public values
ϗ x = ga mod p
ϗ y = gb mod p
ϗ Public values x and y are exchanged
ϗ Compute shared, private key
ϗ Ka= ya mod p
ϗ kb = xb mod p
ϗ Algebraically it can be shown that ka = kb
ϗ Users now have a symmetric secret key to encrypt
Example
Alice and Bob get public numbers
P = 23, g = 9
Alice and Bob compute public values
X = 94 mod 23 = 6561 mod 23 = 6
Y = 93 mod 23 = 729 mod 23 = 16
Alice and Bob exchange public numbers
Alice and Bob compute symmetric keys
ka= ya mod p = 164 mod 23 = 9
kb = xb mod p = 63 mod 23 = 9
Alice and Bob now can talk securely!
DH application
ϗ Diffie-Hellman is currently used in many protocols,
namely:
Secure Sockets Layer (SSL)/Transport Layer Security
(TLS)
Secure Shell (SSH)
Internet Protocol Security (IPSec)
Public Key Infrastructure (PKI)
Message authentication and hash function
ϗ Message authentication is concerned with:
protecting the integrity of a message
validating identity of originator
non-repudiation of origin (dispute resolution)
ϗ Three alternative functions used:
message encryption
message authentication code (MAC)
hash function
Message Authentication Code (MAC)
ϗ Generated by an algorithm that creates a small fixed-sized block
depending on both message and some key
like encryption though need not be reversible
ϗ Appended to message as a signature
ϗ Receiver performs same computation on message and checks it
matches the MAC
ϗ Provides assurance that message is unaltered and comes from
sender
MAC properties
A MAC is a cryptographic checksum
MAC = CK(M)
condenses a variable-length message M
using a secret key K
to a fixed-sized authenticator
Is a many-to-one function
potentially many messages have same MAC
But finding these needs to be very difficult
Hash Functions
condenses arbitrary message to fixed size
usually assume that the hash function is public and not
keyed
MAC which is keyed
hash used to detect changes to message
can use in various ways with message
most often to create a digital signature
Hash Function Properties
a Hash Function produces a fingerprint of some
file/message/data
h = H(M)
condenses a variable-length message M
to a fixed-sized fingerprint
assumed to be public
Requirements for Hash Functions
1. can be applied to any sized message M
2. produces fixed-length output h
3. is easy to compute h=H(M) for any message M
4. given h is infeasible to find x s.t. H(x)=h
one-way property
5. given x is infeasible to find y s.t. H(y)=H(x)
weak collision resistance
6. is infeasible to find any x,y s.t. H(y)=H(x)
strong collision resistance
Hash Algorithms
see similarities in the evolution of hash functions &
block ciphers
increasing power of brute-force attacks
leading to evolution in algorithms
from DES to AES in block ciphers
from MD4 & MD5 to SHA-1 & RIPEMD-160 in hash
algorithms
likewise tend to use common iterative structure as do
block ciphers
MD5
designed by Ronald Rivest (the R in RSA)
latest in a series of MD2, MD4
produces a 128-bit hash value
until recently was the most widely used hash algorithm
in recent times have both brute-force & cryptanalytic
concerns
specified as Internet standard RFC1321
MD5 Overview
How MD5 works?
1. pad message so its length is 448 mod 512
2. append a 64-bit length value to message
3. initialise 4-word (128-bit) MD buffer (A,B,C,D)
4. process message in 16-word (512-bit) blocks:
using 4 rounds of 16 bit operations on message block
& buffer
add output to buffer input to form new buffer value