Henric Johnson 1
Chapter3
Chapter3
Public-Key Cryptography
Public-Key Cryptography
and Message
and Message
Authentication
Authentication
Henric Johnson
Blekinge Institute of Technology, Sweden
http://www.its.bth.se/staff/hjo/
henric.johnson@bth.se
Henric Johnson 2
OUTLINE
OUTLINE
• Approaches to Message
Authentication
• Secure Hash Functions and HMAC
• Public-Key Cryptography Principles
• Public-Key Cryptography Algorithms
• Digital Signatures
• Key Management
Henric Johnson 3
Authentication
Authentication
• Requirements - must be able to verify that:
1. Message came from apparent
source or author,
2. Contents have not been altered,
3. Sometimes, it was sent at a certain
time or sequence.
• Protection against active attack
(falsification of data and transactions)
Henric Johnson 4
Approaches to Message
Approaches to Message
Authentication
Authentication
• Authentication Using Conventional Encryption
– Only the sender and receiver should share a key
• Message Authentication without Message
Encryption
– An authentication tag is generated and appended
to each message
• Message Authentication Code
– Calculate the MAC as a function of the message
and the key. MAC = F(K, M)
Henric Johnson 5
Henric Johnson 6
One-way HASH function
One-way HASH function
Henric Johnson 7
One-way HASH function
One-way HASH function
• Secret value is added before the hash
and removed before transmission.
Henric Johnson 8
Secure HASH Functions
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) such that H(x) = H(y)
x
y 
Henric Johnson 9
Simple Hash Function
Simple Hash Function
• One-bit circular shift on the hash value
after each block is processed would improve
Henric Johnson 10
Message Digest Generation
Message Digest Generation
Using SHA-1
Using SHA-1
Henric Johnson 11
SHA-1 Processing of single
SHA-1 Processing of single
512-Bit Block
512-Bit Block
Henric Johnson 12
Other Secure HASH functions
Other Secure HASH functions
SHA-1 MD5 RIPEMD-
160
Digest length 160 bits 128 bits 160 bits
Basic unit of
processing
512 bits 512 bits 512 bits
Number of
steps
80 (4
rounds of
20)
64 (4
rounds of
16)
160 (5
paired
rounds of
16)
Maximum
message size
264
-1 bits
 
Henric Johnson 13
HMAC
HMAC
• Use a MAC derived from a cryptographic
hash code, such as SHA-1.
• Motivations:
– Cryptographic hash functions executes faster
in software than encryptoin algorithms such as
DES
– Library code for cryptographic hash functions
is widely available
– No export restrictions from the US
Henric Johnson 14
HMAC Structure
HMAC Structure
Henric Johnson 15
Public-Key Cryptography
Public-Key Cryptography
Principles
Principles
• The use of two keys has consequences in:
key distribution, confidentiality and
authentication.
• The scheme has six ingredients (see Figure 3.7)
– Plaintext
– Encryption algorithm
– Public and private key
– Ciphertext
– Decryption algorithm
Henric Johnson 16
Encryption using Public-Key
Encryption using Public-Key
system
system
Henric Johnson 17
Authentication using
Authentication using Public-
Public-
Key System
Key System
Henric Johnson 18
Applications for Public-Key
Applications for Public-Key
Cryptosystems
Cryptosystems
• Three categories:
– Encryption/decryption: The sender
encrypts a message with the recipient’s
public key.
– Digital signature: The sender ”signs” a
message with its private key.
– Key echange: Two sides cooperate two
exhange a session key.
Henric Johnson 19
Requirements for Public-
Requirements for Public-
Key Cryptography
Key Cryptography
1. Computationally easy for a party B
to generate a pair (public key KUb,
private key KRb)
2. Easy for sender to generate
ciphertext:
3. Easy for the receiver to decrypt
ciphertect using private key:
)
(M
E
C KUb

)]
(
[
)
( M
E
D
C
D
M KUb
KRb
KRb 

Henric Johnson 20
Requirements for Public-
Requirements for Public-
Key Cryptography
Key Cryptography
4. Computationally infeasible to determine
private key (KRb) knowing public key (KUb)
5. Computationally infeasible to recover
message M, knowing KUb and ciphertext C
6. Either of the two keys can be used for
encryption, with the other used for
decryption:
)]
(
[
)]
(
[ M
E
D
M
E
D
M KRb
KUb
KUb
KRb 

Henric Johnson 21
Public-Key Cryptographic
Public-Key Cryptographic
Algorithms
Algorithms
• RSA and Diffie-Hellman
• RSA - Ron Rives, Adi Shamir and Len
Adleman at MIT, in 1977.
– RSA is a block cipher
– The most widely implemented
• Diffie-Hellman
– Echange a secret key securely
– Compute discrete logarithms
Henric Johnson 22
The RSA Algorithm –
The RSA Algorithm –
Key Generation
Key Generation
1. Select p,q p and q both prime
2. Calculate n = p x q
3. Calculate
4. Select integer e
5. Calculate d
6. Public Key KU = {e,n}
7. Private key KR = {d,n}
)
1
)(
1
(
)
( 


 q
p
n
)
(
1
;
1
)
),
(
gcd( n
e
e
n 




)
(
mod
1
n
e
d 
 
Henric Johnson 23
Example of RSA Algorithm
Example of RSA Algorithm
Henric Johnson 24
The RSA Algorithm -
The RSA Algorithm -
Encryption
Encryption
• Plaintext: M<n
• Ciphertext: C = Me
(mod n)
Henric Johnson 25
The RSA Algorithm -
The RSA Algorithm -
Decryption
Decryption
• Ciphertext: C
• Plaintext: M = Cd
(mod n)
Henric Johnson 26
Diffie-Hellman Key Echange
Diffie-Hellman Key Echange
Henric Johnson 27
Other Public-Key
Other Public-Key
Cryptographic Algorithms
Cryptographic Algorithms
• Digital Signature Standard (DSS)
– Makes use of the SHA-1
– Not for encryption or key echange
• Elliptic-Curve Cryptography (ECC)
– Good for smaller bit size
– Low confidence level, compared with RSA
– Very complex
Henric Johnson 28
Key Management
Key Management
Public-Key Certificate Use
Public-Key Certificate Use

Chapter 3CrypotgraphyCrypotgraphyCrypotgraphy.ppt

  • 1.
    Henric Johnson 1 Chapter3 Chapter3 Public-KeyCryptography Public-Key Cryptography and Message and Message Authentication Authentication Henric Johnson Blekinge Institute of Technology, Sweden http://www.its.bth.se/staff/hjo/ [email protected]
  • 2.
    Henric Johnson 2 OUTLINE OUTLINE •Approaches to Message Authentication • Secure Hash Functions and HMAC • Public-Key Cryptography Principles • Public-Key Cryptography Algorithms • Digital Signatures • Key Management
  • 3.
    Henric Johnson 3 Authentication Authentication •Requirements - must be able to verify that: 1. Message came from apparent source or author, 2. Contents have not been altered, 3. Sometimes, it was sent at a certain time or sequence. • Protection against active attack (falsification of data and transactions)
  • 4.
    Henric Johnson 4 Approachesto Message Approaches to Message Authentication Authentication • Authentication Using Conventional Encryption – Only the sender and receiver should share a key • Message Authentication without Message Encryption – An authentication tag is generated and appended to each message • Message Authentication Code – Calculate the MAC as a function of the message and the key. MAC = F(K, M)
  • 5.
  • 6.
    Henric Johnson 6 One-wayHASH function One-way HASH function
  • 7.
    Henric Johnson 7 One-wayHASH function One-way HASH function • Secret value is added before the hash and removed before transmission.
  • 8.
    Henric Johnson 8 SecureHASH Functions 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) such that H(x) = H(y) x y 
  • 9.
    Henric Johnson 9 SimpleHash Function Simple Hash Function • One-bit circular shift on the hash value after each block is processed would improve
  • 10.
    Henric Johnson 10 MessageDigest Generation Message Digest Generation Using SHA-1 Using SHA-1
  • 11.
    Henric Johnson 11 SHA-1Processing of single SHA-1 Processing of single 512-Bit Block 512-Bit Block
  • 12.
    Henric Johnson 12 OtherSecure HASH functions Other Secure HASH functions SHA-1 MD5 RIPEMD- 160 Digest length 160 bits 128 bits 160 bits Basic unit of processing 512 bits 512 bits 512 bits Number of steps 80 (4 rounds of 20) 64 (4 rounds of 16) 160 (5 paired rounds of 16) Maximum message size 264 -1 bits  
  • 13.
    Henric Johnson 13 HMAC HMAC •Use a MAC derived from a cryptographic hash code, such as SHA-1. • Motivations: – Cryptographic hash functions executes faster in software than encryptoin algorithms such as DES – Library code for cryptographic hash functions is widely available – No export restrictions from the US
  • 14.
    Henric Johnson 14 HMACStructure HMAC Structure
  • 15.
    Henric Johnson 15 Public-KeyCryptography Public-Key Cryptography Principles Principles • The use of two keys has consequences in: key distribution, confidentiality and authentication. • The scheme has six ingredients (see Figure 3.7) – Plaintext – Encryption algorithm – Public and private key – Ciphertext – Decryption algorithm
  • 16.
    Henric Johnson 16 Encryptionusing Public-Key Encryption using Public-Key system system
  • 17.
    Henric Johnson 17 Authenticationusing Authentication using Public- Public- Key System Key System
  • 18.
    Henric Johnson 18 Applicationsfor Public-Key Applications for Public-Key Cryptosystems Cryptosystems • Three categories: – Encryption/decryption: The sender encrypts a message with the recipient’s public key. – Digital signature: The sender ”signs” a message with its private key. – Key echange: Two sides cooperate two exhange a session key.
  • 19.
    Henric Johnson 19 Requirementsfor Public- Requirements for Public- Key Cryptography Key Cryptography 1. Computationally easy for a party B to generate a pair (public key KUb, private key KRb) 2. Easy for sender to generate ciphertext: 3. Easy for the receiver to decrypt ciphertect using private key: ) (M E C KUb  )] ( [ ) ( M E D C D M KUb KRb KRb  
  • 20.
    Henric Johnson 20 Requirementsfor Public- Requirements for Public- Key Cryptography Key Cryptography 4. Computationally infeasible to determine private key (KRb) knowing public key (KUb) 5. Computationally infeasible to recover message M, knowing KUb and ciphertext C 6. Either of the two keys can be used for encryption, with the other used for decryption: )] ( [ )] ( [ M E D M E D M KRb KUb KUb KRb  
  • 21.
    Henric Johnson 21 Public-KeyCryptographic Public-Key Cryptographic Algorithms Algorithms • RSA and Diffie-Hellman • RSA - Ron Rives, Adi Shamir and Len Adleman at MIT, in 1977. – RSA is a block cipher – The most widely implemented • Diffie-Hellman – Echange a secret key securely – Compute discrete logarithms
  • 22.
    Henric Johnson 22 TheRSA Algorithm – The RSA Algorithm – Key Generation Key Generation 1. Select p,q p and q both prime 2. Calculate n = p x q 3. Calculate 4. Select integer e 5. Calculate d 6. Public Key KU = {e,n} 7. Private key KR = {d,n} ) 1 )( 1 ( ) (     q p n ) ( 1 ; 1 ) ), ( gcd( n e e n      ) ( mod 1 n e d   
  • 23.
    Henric Johnson 23 Exampleof RSA Algorithm Example of RSA Algorithm
  • 24.
    Henric Johnson 24 TheRSA Algorithm - The RSA Algorithm - Encryption Encryption • Plaintext: M<n • Ciphertext: C = Me (mod n)
  • 25.
    Henric Johnson 25 TheRSA Algorithm - The RSA Algorithm - Decryption Decryption • Ciphertext: C • Plaintext: M = Cd (mod n)
  • 26.
    Henric Johnson 26 Diffie-HellmanKey Echange Diffie-Hellman Key Echange
  • 27.
    Henric Johnson 27 OtherPublic-Key Other Public-Key Cryptographic Algorithms Cryptographic Algorithms • Digital Signature Standard (DSS) – Makes use of the SHA-1 – Not for encryption or key echange • Elliptic-Curve Cryptography (ECC) – Good for smaller bit size – Low confidence level, compared with RSA – Very complex
  • 28.
    Henric Johnson 28 KeyManagement Key Management Public-Key Certificate Use Public-Key Certificate Use