SlideShare une entreprise Scribd logo
1  sur  22
Subject:- Information & Network Security
Topic:- RSA & Diffie-Hellman Algorithms
Daxesh Chauhan
Basic Terms in Cryptography
Plain text – A message in its natural format readable by
an attacker.
Cipher text – A message altered to be unreadable by
anyone except the intended recipients.
Key – Sequence that controls the operation and
behavior of the cryptographic algorithm.
Cryptosystem – The combination of algorithm, key, and
key management functions used to perform
cryptographic operations.
Cryptanalysis
• Definition:-
The art or process of deciphering coded
messages without being told the key.
The attacker or the intruder does not have
any knowledge of the key or the algorithm.
The attacker can use various methods
and try to break the code.
Public Key
• A cryptographic key that can be obtained
and used by anyone to encrypt messages
intended for a particular recipient, such
that the encrypted messages can be
deciphered only by using a second key
that is known only to the recipient
(the private key).
Private Key
• A Private key is an encryption
/decryption key known only to the party or
parties that exchange secret messages. In
cryptography, this key would be shared by
the communicators so that each
could encrypt and decrypt message.
Cryptography Methods
• Symmetric
– Same key for encryption and decryption
– Key distribution problem
• Asymmetric
– Mathematically related key pairs for
encryption and decryption
– Public and private keys
Introduction to RSA Algorithm
RSA was first described in 1977 by Ron Rivest, Adi
Shamir and Leonard Adleman of the Massachusetts
Institute of Technology.
Public-key cryptography, also known as asymmetric
cryptography, uses two different but mathematically
linked keys, one public and one private.
The public key can be shared with everyone,
whereas the private key must be kept secret.
• In RSA cryptography, both the public and the
private keys can encrypt a message; the opposite
key from the one used to encrypt a message is
used to decrypt it.
• This is one reason why RSA has become the
most widely used asymmetric algorithm.
• It provides a method of assuring the
confidentiality, integrity, and authenticity of
electronic communications and data storage.
Working of RSA
RSA Algorithm
1. Choose 2 distinct prime numbers.
p = 3 and q = 11.
2. Compute n = p * q = 3 * 11 = 33
3. Compute the Totient function
φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20
4. Choose e such that 1 < e < φ(n) and e and n are co-
prime. Let e = 7
5. Compute a value for d such that (d * e) % φ(n) = 1.
Lets say d = 3
i.e. [(3 * 7) % 20 = 1]
6. Public key is (e, n) => (7, 33)
Private key is (d, n) => (3, 33)
7. For a plain text message m, the encryption function is
c(m) = me mod φ(n).
8. Assuming m=2,
The encryption of m = 2 is
c(m) = 27
mod 33
c(m) = 128 mod 33
c(m) = 29.
9. For cipher text c, the decryption function is
m(c) = cd mod φ(n)
m(c)= 293
mod 33
m(c)= 24389 mod 33
m(c) = 2.
Advantages of RSA
• Very fast and simple encryption.
• Easier to implement.
• Easier to understand.
• Widely deployed, better industry support.
Disadvantages of RSA
• Very slow key generation.
• Slow signing and decryption, which are
slightly tricky to implement securely.
• Key is vulnerable to various attacks if
poorly implemented.
Introduction to Diffie-Hellman
Algorithm
• Diffie–Hellman key exchange (D–H) is a specific
method of securely exchanging cryptographic
keys over a public channel.
• Traditionally, secure encrypted communication
between two parties requires that they first
exchange keys by some secure physical channel,
such as paper key lists transported by a
trusted courier.
• The Diffie–Hellman key exchange method
allows two parties that have no prior
knowledge of each other to jointly
establish a shared secret key over
an insecure channel.
• At the end of the communication both
sender and receiver have the same key.
Working of Diffie-Hellman
Diffie-Hellman Algorithm
1. Alice and Bob agree to use a modulus p = 23 and
base g = 5 (which is a primitive root modulo 23).
2. Alice chooses a secret integer a = 6, then sends Bob
A = ga
mod p
A = 56
mod 23
A = 8
3. Bob chooses a secret integer b = 15, then sends Alice
B = gb
mod p
B = 515
mod 23
B= 19
4. Alice computes s = Ba
mod p
s = 196
mod 23 = 2
5. Bob computes s = Ab
mod p
s = 815
mod 23 = 2
6. Alice and Bob now share a secret (the
number 2).
Hence both Alice and Bob have arrived at the
same value s.
Advantage of Diffie-Hellman Algorithm
• The sender and receiver have no prior
knowledge of each other.
• Communication can take place through an
insecure channel.
• Sharing of secret key is safe.
Disadvantages of Diffie-Hellman
Algorithm
• Can not be used for asymmetric key exchange.
• Can not be used for signing digital signatures.
• The nature of the Diffie-Hellman key exchange
does make it susceptible to man-in-the-middle
attacks since it doesn't authenticate either party
involved in the exchange.
Rsa and diffie hellman algorithms

Contenu connexe

Tendances (20)

CRYPTOGRAPHY & NETWORK SECURITY
CRYPTOGRAPHY & NETWORK SECURITYCRYPTOGRAPHY & NETWORK SECURITY
CRYPTOGRAPHY & NETWORK SECURITY
 
Cryptography
CryptographyCryptography
Cryptography
 
Diffie hellman key exchange algorithm
Diffie hellman key exchange algorithmDiffie hellman key exchange algorithm
Diffie hellman key exchange algorithm
 
DES
DESDES
DES
 
Cryptography - Block cipher & stream cipher
Cryptography - Block cipher & stream cipherCryptography - Block cipher & stream cipher
Cryptography - Block cipher & stream cipher
 
2. Stream Ciphers
2. Stream Ciphers2. Stream Ciphers
2. Stream Ciphers
 
Unit 2
Unit 2Unit 2
Unit 2
 
Cryptographic Algorithms: DES and RSA
Cryptographic Algorithms: DES and RSACryptographic Algorithms: DES and RSA
Cryptographic Algorithms: DES and RSA
 
symmetric key encryption algorithms
 symmetric key encryption algorithms symmetric key encryption algorithms
symmetric key encryption algorithms
 
Double DES & Triple DES
Double DES & Triple DESDouble DES & Triple DES
Double DES & Triple DES
 
Public Key Cryptosystem
Public Key CryptosystemPublic Key Cryptosystem
Public Key Cryptosystem
 
Block Cipher and its Design Principles
Block Cipher and its Design PrinciplesBlock Cipher and its Design Principles
Block Cipher and its Design Principles
 
Web Security
Web SecurityWeb Security
Web Security
 
Elliptic curve cryptography
Elliptic curve cryptographyElliptic curve cryptography
Elliptic curve cryptography
 
Message authentication
Message authenticationMessage authentication
Message authentication
 
MD-5 : Algorithm
MD-5 : AlgorithmMD-5 : Algorithm
MD-5 : Algorithm
 
Symmetric Key Algorithm
Symmetric Key AlgorithmSymmetric Key Algorithm
Symmetric Key Algorithm
 
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key Cryptography
 
Principles of public key cryptography and its Uses
Principles of  public key cryptography and its UsesPrinciples of  public key cryptography and its Uses
Principles of public key cryptography and its Uses
 
Symmetric and asymmetric key
Symmetric and asymmetric keySymmetric and asymmetric key
Symmetric and asymmetric key
 

Similaire à Rsa and diffie hellman algorithms

Similaire à Rsa and diffie hellman algorithms (20)

Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
 
CNS - Unit - 4 - Public Key Cryptosystem
CNS - Unit - 4 - Public Key Cryptosystem CNS - Unit - 4 - Public Key Cryptosystem
CNS - Unit - 4 - Public Key Cryptosystem
 
White Paper on Cryptography
White Paper on Cryptography White Paper on Cryptography
White Paper on Cryptography
 
Unit 3(1)
Unit 3(1)Unit 3(1)
Unit 3(1)
 
Pooguzhali
PooguzhaliPooguzhali
Pooguzhali
 
Public key algorithm
Public key algorithmPublic key algorithm
Public key algorithm
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
Unit 3(1)
Unit 3(1)Unit 3(1)
Unit 3(1)
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
 
Unit 7 : Network Security
Unit 7 : Network SecurityUnit 7 : Network Security
Unit 7 : Network Security
 
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
 
PUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.pptPUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.ppt
 
Introduction to cryptography
Introduction to cryptographyIntroduction to cryptography
Introduction to cryptography
 
Ch09
Ch09Ch09
Ch09
 
Applying Security Algorithms Using openSSL crypto library
Applying Security Algorithms Using openSSL crypto libraryApplying Security Algorithms Using openSSL crypto library
Applying Security Algorithms Using openSSL crypto library
 
Module2.pptx
Module2.pptxModule2.pptx
Module2.pptx
 
Ch9
Ch9Ch9
Ch9
 
Unit --3.ppt
Unit --3.pptUnit --3.ppt
Unit --3.ppt
 
information security(Public key encryption its characteristics and weakness, ...
information security(Public key encryption its characteristics and weakness, ...information security(Public key encryption its characteristics and weakness, ...
information security(Public key encryption its characteristics and weakness, ...
 
3 pkc+rsa
3 pkc+rsa3 pkc+rsa
3 pkc+rsa
 

Plus de daxesh chauhan

Elastic beam (bending of beam model)
Elastic beam (bending of beam model)Elastic beam (bending of beam model)
Elastic beam (bending of beam model)daxesh chauhan
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
Insertionsort shellsort heapsort
Insertionsort shellsort heapsortInsertionsort shellsort heapsort
Insertionsort shellsort heapsortdaxesh chauhan
 
COMBINATIONAL PLD-BASED STATE MACHINES
COMBINATIONAL PLD-BASED STATE MACHINESCOMBINATIONAL PLD-BASED STATE MACHINES
COMBINATIONAL PLD-BASED STATE MACHINESdaxesh chauhan
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop pptdaxesh chauhan
 
Input - output organzation
Input - output organzationInput - output organzation
Input - output organzationdaxesh chauhan
 

Plus de daxesh chauhan (7)

Elastic beam (bending of beam model)
Elastic beam (bending of beam model)Elastic beam (bending of beam model)
Elastic beam (bending of beam model)
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Insertionsort shellsort heapsort
Insertionsort shellsort heapsortInsertionsort shellsort heapsort
Insertionsort shellsort heapsort
 
COMBINATIONAL PLD-BASED STATE MACHINES
COMBINATIONAL PLD-BASED STATE MACHINESCOMBINATIONAL PLD-BASED STATE MACHINES
COMBINATIONAL PLD-BASED STATE MACHINES
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
 
Cn ppt
Cn  pptCn  ppt
Cn ppt
 
Input - output organzation
Input - output organzationInput - output organzation
Input - output organzation
 

Dernier

Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 

Dernier (20)

Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 

Rsa and diffie hellman algorithms

  • 1. Subject:- Information & Network Security Topic:- RSA & Diffie-Hellman Algorithms Daxesh Chauhan
  • 2. Basic Terms in Cryptography Plain text – A message in its natural format readable by an attacker. Cipher text – A message altered to be unreadable by anyone except the intended recipients. Key – Sequence that controls the operation and behavior of the cryptographic algorithm. Cryptosystem – The combination of algorithm, key, and key management functions used to perform cryptographic operations.
  • 3. Cryptanalysis • Definition:- The art or process of deciphering coded messages without being told the key. The attacker or the intruder does not have any knowledge of the key or the algorithm. The attacker can use various methods and try to break the code.
  • 4. Public Key • A cryptographic key that can be obtained and used by anyone to encrypt messages intended for a particular recipient, such that the encrypted messages can be deciphered only by using a second key that is known only to the recipient (the private key).
  • 5. Private Key • A Private key is an encryption /decryption key known only to the party or parties that exchange secret messages. In cryptography, this key would be shared by the communicators so that each could encrypt and decrypt message.
  • 6.
  • 7. Cryptography Methods • Symmetric – Same key for encryption and decryption – Key distribution problem • Asymmetric – Mathematically related key pairs for encryption and decryption – Public and private keys
  • 8. Introduction to RSA Algorithm RSA was first described in 1977 by Ron Rivest, Adi Shamir and Leonard Adleman of the Massachusetts Institute of Technology. Public-key cryptography, also known as asymmetric cryptography, uses two different but mathematically linked keys, one public and one private. The public key can be shared with everyone, whereas the private key must be kept secret.
  • 9. • In RSA cryptography, both the public and the private keys can encrypt a message; the opposite key from the one used to encrypt a message is used to decrypt it. • This is one reason why RSA has become the most widely used asymmetric algorithm. • It provides a method of assuring the confidentiality, integrity, and authenticity of electronic communications and data storage.
  • 11. RSA Algorithm 1. Choose 2 distinct prime numbers. p = 3 and q = 11. 2. Compute n = p * q = 3 * 11 = 33 3. Compute the Totient function φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20 4. Choose e such that 1 < e < φ(n) and e and n are co- prime. Let e = 7 5. Compute a value for d such that (d * e) % φ(n) = 1. Lets say d = 3 i.e. [(3 * 7) % 20 = 1]
  • 12. 6. Public key is (e, n) => (7, 33) Private key is (d, n) => (3, 33) 7. For a plain text message m, the encryption function is c(m) = me mod φ(n). 8. Assuming m=2, The encryption of m = 2 is c(m) = 27 mod 33 c(m) = 128 mod 33 c(m) = 29. 9. For cipher text c, the decryption function is m(c) = cd mod φ(n) m(c)= 293 mod 33 m(c)= 24389 mod 33 m(c) = 2.
  • 13. Advantages of RSA • Very fast and simple encryption. • Easier to implement. • Easier to understand. • Widely deployed, better industry support.
  • 14. Disadvantages of RSA • Very slow key generation. • Slow signing and decryption, which are slightly tricky to implement securely. • Key is vulnerable to various attacks if poorly implemented.
  • 15. Introduction to Diffie-Hellman Algorithm • Diffie–Hellman key exchange (D–H) is a specific method of securely exchanging cryptographic keys over a public channel. • Traditionally, secure encrypted communication between two parties requires that they first exchange keys by some secure physical channel, such as paper key lists transported by a trusted courier.
  • 16. • The Diffie–Hellman key exchange method allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure channel. • At the end of the communication both sender and receiver have the same key.
  • 18. Diffie-Hellman Algorithm 1. Alice and Bob agree to use a modulus p = 23 and base g = 5 (which is a primitive root modulo 23). 2. Alice chooses a secret integer a = 6, then sends Bob A = ga mod p A = 56 mod 23 A = 8 3. Bob chooses a secret integer b = 15, then sends Alice B = gb mod p B = 515 mod 23 B= 19
  • 19. 4. Alice computes s = Ba mod p s = 196 mod 23 = 2 5. Bob computes s = Ab mod p s = 815 mod 23 = 2 6. Alice and Bob now share a secret (the number 2). Hence both Alice and Bob have arrived at the same value s.
  • 20. Advantage of Diffie-Hellman Algorithm • The sender and receiver have no prior knowledge of each other. • Communication can take place through an insecure channel. • Sharing of secret key is safe.
  • 21. Disadvantages of Diffie-Hellman Algorithm • Can not be used for asymmetric key exchange. • Can not be used for signing digital signatures. • The nature of the Diffie-Hellman key exchange does make it susceptible to man-in-the-middle attacks since it doesn't authenticate either party involved in the exchange.