10.Public-Key Cryptography and Message Authentication RSA
10.Public-Key Cryptography and Message Authentication RSA
부산대학교 공과대학
정보컴퓨터공학부
Learning Objectives
Discuss Technical Detail Concerning:
Secure Hash Functions and HMAC
2
Simple Hash Functions
Purpose is to produce a “fingerprint” of a file, message, or other
block of data
3
Cryptograph Hash Function
A cryptographic hash function takes a message of arbitrary length
and creates a message digest of fixed length.
4
Cryptograph Hash Function
Properties of
Secure Hash • H can be applied to a block of data of any size.
1.
Functions
To be useful for • H produces a fixed-length output.
2.
message
authentication,
• H(x) is relatively easy to compute for any given x, making both hardware and
a hash function 3. software implementations practical.
H must have
the following • For any given code h, it is computationally infeasible to find x such that H(x)
= h. A hash function with this property is referred to as one-way or
properties: 4. preimage resistant.
• For any given block x, it is computationally infeasible to find y≠x with H(y) =
H(x). A hash function with this property is referred to as weak collision
5. resistant.
• It is computationally infeasible to find any pair (x, y) such that H(x) = H(y).
• A hash function with this property is referred to as collision resistant or strong
6. collision resistant.
5
Cryptograph Hash Function
Two Groups of Compression Functions
The compression function is made from scratch.
A symmetric-key block cipher serves as a compression function.
Groups of
Compression
Functions
• MD5: Divides message into blocks of 512 bits, and creates a 128-bit digest.
– The digest size of 128-bit is too small to resist collision attack.
6
Iterated Cryptographic Hash Function
Merkle-Damagard Scheme
Rabin Scheme
7
Iterated Cryptographic Hash Function
Matyas-Meyer-Oseas Scheme
Miyaguchi-Preneel Scheme
8
SHA
Secure Hash Algorithms (SHAs)
Originally developed by NIST/NSA in 1993
Was revised in 1995 as SHA-1
• US standard for use with DSA(digital signature algorithm) signature scheme
• standard is FIPS 180-1 1995, also Internet RFC3174
• produces 160-bit hash values
9
SHA-512 Structure
SHA-512 creates a 512-bit message digest out of a message less
than 2128.
SHA-512 is based on the Merkle-Damgard scheme.
Initialization of SHA-512
10
SHA-512 Structure
Padding and Length Field in SHA-512
What is the number of padding bits if the length of the original message is
2590 bits?
• The padding consists of one 1 followed by 353 0’s.
11
SHA-512 Structure
Word Expansion in SHA-512
• W60 is made as
12
SHA-512 Structure
Structure of Each Round in Eighty constant, K0 to K79, used for
SHA-512 eight rounds in SHA-512
13
Other Secure Hash Functions
Most based on iterated hash function design
If compression function is collision resistant, so is resultant iterated hash
function
MD5 (RFC1321)
was a widely used hash developed by Ron Rivest
14
Whirlpool
Whirlpool hash function
15
Whirlpool
16
HMAC
Interest a MAC using a cryptographic hash
Due to speed and code availability
17
Nested Message Authentication Code (MAC)
Message Authentication Code
The security of a MAC depends on the security of the underlying hash algorithm
Nested MAC
18
HMAC Structure
Details of HMAC Details of CMAC
19
Security of HMAC
Security based on underlying hash strength
– With a birthday attack, it is possible to find a collision of a hash function in 2n/2 being the
classical preimage resistance security.
20
Key Management: Diffie-Hellman Key Exchange
First published public-key algorithm
21
Key Management: Diffie-Hellman Key Exchange
A Key Exchange Protocol
provide a secure way for two communicating party to share a symmetric key (so
called a session key)
This session key is then used to provide privacy and authentication for
subsequent message flow.
History: problem first posed by Merkle at UC Berkeley, Diffie and Hellman came
up with the protocol:
Alice Bob
a<p b<p
ga mod p
gb mod p
• W. Diffie, M. E. Hellman, “New directions in Cryptography”, IEEE Trans. Information Theory, IT-22, pp. 64-654, Nov 1976.
22
Key Management: Diffie-Hellman Key Exchange
Example
Let us give a trivial example to make the procedure clear. Our example uses
small numbers, but note that in a real situation, the numbers are very large.
Assume that g = 7 and p = 23. The steps are as follows:
23
Security of Diffie-Hellman
Man-in-the-middle (MITM) attack
24
RSA Public-Key Encryption
By Rivest, Shamir & Adleman of MIT in 1977
Best known & widely used public-key algorithm
Uses exponentiation of integers modulo a prime
It works in group 𝑍𝑛∗
Based on the assumed one-way property of modular powering
26
RSA Public-Key Encryption
Two Algebraic Structures
R = <Zn , +, × >
Encryption/Decryption Ring:
Proof of RSA
Looking for a trapdoor: (xe)d mod n = x
• If d is a number such that ed=1 mod f(n), then ed=kf(n)+1 for some k, and
27
RSA Public-Key Encryption
RSA Key Setup
Each user generates a public/private key pair by:
• selecting two large primes at random - p, q
28
RSA Public-Key Encryption
Pseudo Code of Encryption
29
RSA Example
Jennifer creates a pair of keys for herself. She chooses p = 397 and
q = 401. She calculates n = 159197. She then calculates f(n) =
158400. She then chooses e = 343 and d = 12007. Show how
Ted can send a message to Jennifer if he knows e and n.
Suppose Ted wants to send the message “NO” to Jennifer. He changes each
character to a number (from 00 to 25), with each character coded as two digits.
He then concatenates the two coded characters and gets a four-digit number.
The plaintext is 1314.
30
Attacks on RSA
31
Other Public-Key Algorithms
Digital Signature Standard (DSS)
FIPS PUB 186 from 1991, revised 1993 & 96
32
33