CH 3
CH 3
Public-Key Cryptography
and Message
Authentication
Outline
Approaches to Message Authentication
Secure Hash Functions and HMAC
Public-Key Cryptography Principles
Public-Key Cryptography Algorithms
Digital Signatures
Key Management
Message Authentication
Message authentication is a mechanism or
service used to verify message’s integrity
Hash Function
maps a variable-length message into a fixed
length hash value (message digest)
a secure hash function must be combined with
a secret key
One-way HASH function
One-way HASH function...cont
Secret value is added before the hash and removed
before transmission.
Secure HASH Functions
Purpose of the HASH function is to produce a
”fingerprint”.
Properties of a HASH function H :
1. H can be applied to a block of data at any size
2. H produces a fixed length output
3. H(x) is easy to compute for any given x.
4. For any given block x, it is computationally infeasible to
find x such that H(x) = h
5. For any given block x, it is computationally infeasible to
find with H(y) = H(x).
6. It is computationally infeasible to find any pair (x, y)
suchythat
xH(x) = H(y)
Simple Hash Function
Block 1 0 1 1 1 0
Block 2 1 0 0 0 1
Block 3 1 0 1 0 1
Block 4 1 1 1 1 0
Block 5 1 1 1 0 1
Block 6 1 1 1 1 1
Hash Code 1 0 1 1 0
Block 1 1 1 0 0 1
Block 2 0 0 1 1 0
Block 3 1 0 1 1 0
Block 4 1 1 1 0 1
Block 5 1 1 1 1 0
Hash Code 0 1 0 1 0
22 0 0 0 1 0 1 1 0
19 0 0 0 1 0 0 1 1
21 0 0 0 1 0 1 0 1
9 0 0 0 0 1 0 0 1
31 0 0 0 1 1 1 1 1
15 0 0 0 0 1 1 1 1
C E KUb (M )
Plaintext: M<n
Ciphertext: C = Me (mod n)
The RSA Algorithm - Decryption
Ciphertext: C
Plaintext: M = Cd (mod n)
Example 5
Perform the encryption and decryption
using the RSA algorithm based on the
given value.
P=Cd (mod n)
P=4211 mod 143
=[421 mod 143 x 422 mod 143 x 424 mod 143 x 424 mod 143x ] mod 143
=[42 x 48 x 16 x16] mod 143
=516096 mod 143
=9
Diffie-Hellman Key Echange
Diffie Hellman Key Exchange
First published public-key algorithm
(1976)
Purpose is to allow two users to exchange
a private key
Diffie-Hellman depends on the difficulty in
computing discrete logarithms (inverse
exponentials)
Choose a prime p, consider the sequence
a mod p, a2 mod p, a3 mod p, … ap-1 mod
p
Con’t
If these are distinct and a permutation of
1 … p-1, then
1. b = ai mod p then ‘i’ is the discrete
logarithm of b
2. a is called a primitive root of p
Diffie-Hellman fig 3.10
Example 6
Using a Diffie Hellman scheme with a common prome
q=11 and primitive root, σ =2.
YA =σ XA
mod q
= 2XA mod 11
= 26 mod 11
XA = 6
Example 6, Con’t
b) If user B has public key YB =3, What is the
shared key K.