SlideShare a Scribd company logo
Chapter3
Public-Key Cryptography
      and Message
     Authentication
                Henric Johnson
    Blekinge Institute of Technology, Sweden
       http://www.its.bth.se/staff/hjo/
             henric.johnson@bth.se

          Henric Johnson                       1
OUTLINE
• Approaches to Message
  Authentication
• Secure Hash Functions and HMAC
• Public-Key Cryptography Principles
• Public-Key Cryptography Algorithms
• Digital Signatures
• Key Management
            Henric Johnson   2
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       3
Approaches to Message
       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          4
Henric Johnson   5
One-way HASH function




     Henric Johnson   6
One-way HASH function
• Secret value is added before the hash
  and removed before transmission.




            Henric Johnson   7
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).
                            y≠x
    6. It is computationally infeasible to find any
       pair (x, y) such that H(x) = H(y)
                   Henric Johnson           8
Simple Hash Function




• One-bit circular shift on the hash value
  after each block is processed would improve
              Henric Johnson      9
Message Digest Generation
      Using SHA-1




       Henric Johnson   10
SHA-1 Processing of single
     512-Bit Block




        Henric Johnson   11
Other Secure HASH functions
                SHA-1         MD5         RIPEMD-
                                          160
Digest length   160 bits      128 bits    160 bits
Basic unit of   512 bits      512 bits    512 bits
processing

Number of       80 (4         64 (4     160 (5
steps           rounds of     rounds of paired
                20)           16)       rounds of
                                  ∞     16)   ∞
Maximum         264-1 bits
                 Henric Johnson          12
message size
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          13
HMAC Structure




  Henric Johnson   14
Public-Key Cryptography
           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      15
Encryption using Public-Key
          system




        Henric Johnson   16
Authentication using Public-
       Key System




        Henric Johnson   17
Applications for Public-Key
      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      18
Requirements for Public-
     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: C = EKUb (M )
3. Easy for the receiver to decrypt
   ciphertect using private key:
   M = DKRb (C ) = DKRb [ E KUb ( M )]
             Henric Johnson     19
Requirements for Public-
     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 = DKRb [ EKUb ( M )] = DKUb [ EKRb ( M )]

                Henric Johnson          20
Public-Key Cryptographic
         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       21
The RSA Algorithm –
            Key Generation
1.   Select p,q                  p and q both prime
2.   Calculate n = p x q
3.   Calculate Φ (n) = ( p − 1)(q − 1)
4.   Select integer e           gcd(Φ (n), e) = 1; 1 < e < Φ (n)
                                       −1
5.   Calculate d                d = e mod Φ (n)
6.   Public Key                  KU = {e,n}
7.   Private key                 KR = {d,n}


                     Henric Johnson            22
Example of RSA Algorithm




       Henric Johnson   23
The RSA Algorithm -
         Encryption
• Plaintext:                    M<n

• Ciphertext:                   C = Me (mod n)




               Henric Johnson          24
The RSA Algorithm -
         Decryption
• Ciphertext:                   C

• Plaintext:                    M = Cd (mod n)




               Henric Johnson          25
Diffie-Hellman Key Echange




        Henric Johnson   26
Other Public-Key
 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      27
Key Management
Public-Key Certificate Use




        Henric Johnson   28

More Related Content

What's hot

CRYPTOGRAPHY & NETWOK SECURITY- Symmetric key Ciphers
CRYPTOGRAPHY & NETWOK SECURITY- Symmetric key CiphersCRYPTOGRAPHY & NETWOK SECURITY- Symmetric key Ciphers
CRYPTOGRAPHY & NETWOK SECURITY- Symmetric key Ciphers
Jyothishmathi Institute of Technology and Science Karimnagar
 
12 symmetric key cryptography
12   symmetric key cryptography12   symmetric key cryptography
12 symmetric key cryptographydrewz lin
 
Cryptography and Information Security
Cryptography and Information SecurityCryptography and Information Security
Cryptography and Information Security
Dr Naim R Kidwai
 
Basic techniques in cryptography
Basic techniques in cryptographyBasic techniques in cryptography
Basic techniques in cryptography
Shraddha Gupta
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
Priyamvada Singh
 
Cryptography 101
Cryptography 101Cryptography 101
Cryptography 101
Aditya Kamat
 
Distribution of public keys and hmac
Distribution of public keys and hmacDistribution of public keys and hmac
Distribution of public keys and hmac
anuragjagetiya
 
Fundamentals of Information Encryption
Fundamentals of Information EncryptionFundamentals of Information Encryption
Fundamentals of Information Encryption
Amna Magzoub
 
Cryptography
CryptographyCryptography
Cryptography
Smruti Ranjan Sahoo
 
Chapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption StandardChapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption Standard
Shafaan Khaliq Bhatti
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
shivz3
 
Cryptography Attacks and Applications
Cryptography Attacks and ApplicationsCryptography Attacks and Applications
Cryptography Attacks and Applications
UTD Computer Security Group
 
Secret key cryptography
Secret key cryptographySecret key cryptography
Secret key cryptography
Prabhat Goel
 
Cryptography Ashik
Cryptography AshikCryptography Ashik
Cryptography Ashik
Ashik Iqbal
 
Classical Encryption Techniques in Network Security
Classical Encryption Techniques in Network SecurityClassical Encryption Techniques in Network Security
Classical Encryption Techniques in Network Security
babak danyal
 
Classical encryption techniques
Classical encryption techniquesClassical encryption techniques
Classical encryption techniques
ramya marichamy
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-ittrameshvvv
 
Cryptography and Network security # Lecture 4
Cryptography and Network security # Lecture 4Cryptography and Network security # Lecture 4
Cryptography and Network security # Lecture 4
Kabul Education University
 

What's hot (20)

CRYPTOGRAPHY & NETWOK SECURITY- Symmetric key Ciphers
CRYPTOGRAPHY & NETWOK SECURITY- Symmetric key CiphersCRYPTOGRAPHY & NETWOK SECURITY- Symmetric key Ciphers
CRYPTOGRAPHY & NETWOK SECURITY- Symmetric key Ciphers
 
12 symmetric key cryptography
12   symmetric key cryptography12   symmetric key cryptography
12 symmetric key cryptography
 
Cryptography and Information Security
Cryptography and Information SecurityCryptography and Information Security
Cryptography and Information Security
 
Basic techniques in cryptography
Basic techniques in cryptographyBasic techniques in cryptography
Basic techniques in cryptography
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
 
Cryptography 101
Cryptography 101Cryptography 101
Cryptography 101
 
Distribution of public keys and hmac
Distribution of public keys and hmacDistribution of public keys and hmac
Distribution of public keys and hmac
 
Fundamentals of Information Encryption
Fundamentals of Information EncryptionFundamentals of Information Encryption
Fundamentals of Information Encryption
 
Cryptography
CryptographyCryptography
Cryptography
 
Cns Chapter 2
Cns Chapter 2Cns Chapter 2
Cns Chapter 2
 
Chapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption StandardChapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption Standard
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Cryptography Attacks and Applications
Cryptography Attacks and ApplicationsCryptography Attacks and Applications
Cryptography Attacks and Applications
 
Secret key cryptography
Secret key cryptographySecret key cryptography
Secret key cryptography
 
Cryptography Ashik
Cryptography AshikCryptography Ashik
Cryptography Ashik
 
Classical Encryption Techniques in Network Security
Classical Encryption Techniques in Network SecurityClassical Encryption Techniques in Network Security
Classical Encryption Techniques in Network Security
 
Classical encryption techniques
Classical encryption techniquesClassical encryption techniques
Classical encryption techniques
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
 
Cryptography and Network security # Lecture 4
Cryptography and Network security # Lecture 4Cryptography and Network security # Lecture 4
Cryptography and Network security # Lecture 4
 

Similar to Chapter 3

Chapter 2
Chapter 2Chapter 2
Chapter 2
shivz3
 
Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3koolkampus
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
SurendraBasnet6
 
Cybersecurity cyberlab3
Cybersecurity cyberlab3Cybersecurity cyberlab3
Cybersecurity cyberlab3
rayborg
 
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptxUnit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
VishwanathMahalle
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
ArthyR3
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
ArthyR3
 
Cryptography - 101
Cryptography - 101Cryptography - 101
cryptography deepan fav subject
cryptography deepan fav subjectcryptography deepan fav subject
cryptography deepan fav subject
deepan v
 
Cryptography and steganography lesson and discription.pptx
Cryptography and steganography lesson and discription.pptxCryptography and steganography lesson and discription.pptx
Cryptography and steganography lesson and discription.pptx
RobertCarreonBula
 
Hash Function
Hash FunctionHash Function
Hash Function
Siddharth Srivastava
 
CISSP Week 20
CISSP Week 20CISSP Week 20
CISSP Week 20jemtallon
 
CH02-CompSec4e.pptx
CH02-CompSec4e.pptxCH02-CompSec4e.pptx
CH02-CompSec4e.pptx
ams1ams11
 
Cns
CnsCns
Cns
ArthyR3
 
ch05.ppt
ch05.pptch05.ppt
ch05.ppt
KaivanParikh
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
shivz3
 
Cryptography & Steganography
Cryptography & SteganographyCryptography & Steganography
Cryptography & Steganography
Animesh Shaw
 
Common Crypto Pitfalls
Common Crypto PitfallsCommon Crypto Pitfalls
Common Crypto Pitfalls
Amirali Sanatinia
 
Encryption
EncryptionEncryption
Encryption
IGZ Software house
 

Similar to Chapter 3 (20)

Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
Cybersecurity cyberlab3
Cybersecurity cyberlab3Cybersecurity cyberlab3
Cybersecurity cyberlab3
 
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptxUnit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
 
Cryptography - 101
Cryptography - 101Cryptography - 101
Cryptography - 101
 
Cryptography-101
Cryptography-101Cryptography-101
Cryptography-101
 
cryptography deepan fav subject
cryptography deepan fav subjectcryptography deepan fav subject
cryptography deepan fav subject
 
Cryptography and steganography lesson and discription.pptx
Cryptography and steganography lesson and discription.pptxCryptography and steganography lesson and discription.pptx
Cryptography and steganography lesson and discription.pptx
 
Hash Function
Hash FunctionHash Function
Hash Function
 
CISSP Week 20
CISSP Week 20CISSP Week 20
CISSP Week 20
 
CH02-CompSec4e.pptx
CH02-CompSec4e.pptxCH02-CompSec4e.pptx
CH02-CompSec4e.pptx
 
Cns
CnsCns
Cns
 
ch05.ppt
ch05.pptch05.ppt
ch05.ppt
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Cryptography & Steganography
Cryptography & SteganographyCryptography & Steganography
Cryptography & Steganography
 
Common Crypto Pitfalls
Common Crypto PitfallsCommon Crypto Pitfalls
Common Crypto Pitfalls
 
Encryption
EncryptionEncryption
Encryption
 

Chapter 3

  • 1. Chapter3 Public-Key Cryptography and Message Authentication Henric Johnson Blekinge Institute of Technology, Sweden http://www.its.bth.se/staff/hjo/ henric.johnson@bth.se Henric Johnson 1
  • 2. OUTLINE • Approaches to Message Authentication • Secure Hash Functions and HMAC • Public-Key Cryptography Principles • Public-Key Cryptography Algorithms • Digital Signatures • Key Management Henric Johnson 2
  • 3. 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 3
  • 4. Approaches to Message 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 4
  • 6. One-way HASH function Henric Johnson 6
  • 7. One-way HASH function • Secret value is added before the hash and removed before transmission. Henric Johnson 7
  • 8. 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). y≠x 6. It is computationally infeasible to find any pair (x, y) such that H(x) = H(y) Henric Johnson 8
  • 9. Simple Hash Function • One-bit circular shift on the hash value after each block is processed would improve Henric Johnson 9
  • 10. Message Digest Generation Using SHA-1 Henric Johnson 10
  • 11. SHA-1 Processing of single 512-Bit Block Henric Johnson 11
  • 12. Other Secure HASH functions SHA-1 MD5 RIPEMD- 160 Digest length 160 bits 128 bits 160 bits Basic unit of 512 bits 512 bits 512 bits processing Number of 80 (4 64 (4 160 (5 steps rounds of rounds of paired 20) 16) rounds of ∞ 16) ∞ Maximum 264-1 bits Henric Johnson 12 message size
  • 13. 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 13
  • 14. HMAC Structure Henric Johnson 14
  • 15. Public-Key Cryptography 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 15
  • 16. Encryption using Public-Key system Henric Johnson 16
  • 17. Authentication using Public- Key System Henric Johnson 17
  • 18. Applications for Public-Key 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 18
  • 19. Requirements for Public- 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: C = EKUb (M ) 3. Easy for the receiver to decrypt ciphertect using private key: M = DKRb (C ) = DKRb [ E KUb ( M )] Henric Johnson 19
  • 20. Requirements for Public- 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 = DKRb [ EKUb ( M )] = DKUb [ EKRb ( M )] Henric Johnson 20
  • 21. Public-Key Cryptographic 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 21
  • 22. The RSA Algorithm – Key Generation 1. Select p,q p and q both prime 2. Calculate n = p x q 3. Calculate Φ (n) = ( p − 1)(q − 1) 4. Select integer e gcd(Φ (n), e) = 1; 1 < e < Φ (n) −1 5. Calculate d d = e mod Φ (n) 6. Public Key KU = {e,n} 7. Private key KR = {d,n} Henric Johnson 22
  • 23. Example of RSA Algorithm Henric Johnson 23
  • 24. The RSA Algorithm - Encryption • Plaintext: M<n • Ciphertext: C = Me (mod n) Henric Johnson 24
  • 25. The RSA Algorithm - Decryption • Ciphertext: C • Plaintext: M = Cd (mod n) Henric Johnson 25
  • 26. Diffie-Hellman Key Echange Henric Johnson 26
  • 27. Other Public-Key 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 27
  • 28. Key Management Public-Key Certificate Use Henric Johnson 28