SlideShare a Scribd company logo
1 of 13
Key Exchange Methods
Diffie-Hellman and RSA
CPE 701 Research Case Study
Derek Eiler | April 2012
Overview
Today’s discussion
• Background: “key” cryptography concepts
• Diffie-Hellman key exchange
• Public key infrastructure (PKI)
• RSA key pair generation
Background
A few “key” concepts
• Encryption: plaintext -> ciphertext
• Decryption: ciphertext -> plaintext
• Cryptographic function: mathematical
function or algorithm used to encrypt/decrypt
• Key: parameter for a cryptographic function
• Symmetric vs. asymmetric keys
So four people walk into a bar…
Alice, Bob, Eve, and Mallory
• Alice and Bob want to speak privately over a
public channel
• Eve is always eavesdropping on Alice and Bob
• Mallory has malicious plans to interfere with
Alice and Bob’s private conversation
Diffie-Hellman key exchange
The concept
• Alice and Bob derive a shared secret key over
a public channel (no prior arrangements)
• Publicly agree on two public values, 𝑝 and 𝑔
• Each choose a private value, 𝑎 and 𝑏
• Use clever math to compute a shared secret, 𝑘
• Eve and Mallory never overhear enough
information to derive the shared secret
Diffie-Hellman key exchange
The math: discrete logarithm problem
Let 𝑝 be a large prime number
Let 𝑔 be an integer < 𝑝
For every number 𝑛 from 1 … 𝑝 − 1 , inclusive,
𝑔 must have a power 𝑘 such that:
𝑛 = 𝑔𝑘
mod 𝑝
• Solving the 𝑘𝑡ℎ
root mod 𝑝 is considered (but
not proven) hard to do in polynomial time
Diffie-Hellman key exchange
The math: discrete logarithm in action
Solve for 𝑘, given values 𝑝, 𝑔, 𝑎′, 𝑏′ and knowing:
𝑘 = 𝑔𝑎𝑏
= 𝑔𝑏𝑎
𝑎′
= 𝑔𝑎
mod 𝑝
𝑏′
= 𝑔𝑏
mod 𝑝
𝑘 = (𝑏′)𝑎
mod 𝑝
𝑘 = (𝑎′)𝑏
mod 𝑝
• Finding 𝑘 is easy if 𝑎 or 𝑏 are known
• Quickly solved by brute force if 𝑝 = 3 and 𝑔 = 2
• What if 𝑝 = 6,461,333,867 and 𝑔 = 3,691?
Diffie-Hellman key exchange
Example using small numbers
Alice starts the exchange and tells Bob 𝑝 = 7, 𝑔 = 1
Privately, Alice chooses 𝑎 = 3 and Bob chooses 𝑏 = 5
Alice computes 𝑎′ = 𝑔𝑎 mod 𝑝 and tells Bob the result
𝑎′
= 23
mod 7 = 1
Bob computes 𝑏′ = 𝑔𝑏 mod 𝑝 and tells Alice the result
𝑏′ = 25 mod 7 = 4
Since k = 𝑔𝑏𝑎
, Alice can compute 𝑘 = (𝑏′)𝑎
mod 𝑝
𝑘 = (4)3
mod 7 = 1
Since k = 𝑔𝑎𝑏
, Bob can compute 𝑘 = (𝑎′)𝑏
mod 𝑝
𝑘 = (1)5 mod 7 = 1
Meanwhile, Eve doesn’t know 𝑎 or 𝑏 and can’t easily derive 𝑘
RSA key generation
The concept
• Alice generates a pair of keys, publishing one
and keeping the other private
• Anyone may use the published key to encrypt
messages intended for Alice
• Only Alice can decrypt messages encrypted
with the public key (unless the private key was
compromised somehow)
• Alice may also use the key pair to prove her
identity
RSA key generation
The math: factoring problem
• Computing the product of two prime numbers is
easy (23*17 = 391)
• Factoring the product of two large prime
numbers is “hard”
• Try factoring
123,018,668,453,011,775,513,049,495,838,496,2
72,077,285,356,959,533,479,219,732,245,215,17
2,640,050,726,365,751,874,520,219,978,646,938
,995,647,494,277,406,384,592,519,255,732,630,
345,373,154,826,850,791,702,612,214,291,346,1
67,042,921,431,160,222,124,047,927,473,779,40
8,066,535,141,959,745,986,902,143,413
RSA key generation
The math: public and private key pair
• Calculate the product 𝑛 = 𝑝𝑞 where 𝑝 and 𝑞
are very large prime numbers (e.g. tens or
even hundreds of digits long)
• Carefully choose exponents 𝑒 and 𝑑 such that
we can publish the key 𝑘𝑝𝑢𝑏 = (𝑛, 𝑒) and
retain the corresponding private key 𝑘𝑝𝑟𝑖𝑣 =
(𝑛, 𝑑)
RSA key generation
The math: “exponential” difficulty
• Choose an 𝑒 such that 𝑒 < 𝑛 and 𝑒 is coprime
to 𝑝 − 1 𝑞 − 1
• How? For each 𝑒 in {2 … 𝑝𝑞}, test whether
GCD 𝑒, 𝑝 − 1 𝑞 − 1 = 1 until true.*
• Choose a 𝑑 such that 𝑒𝑑 − 1 is divisible by
𝑝 − 1 𝑞 − 1
• Now publish 𝑘𝑝𝑢𝑏 = (𝑛, 𝑒) and retain the
private key 𝑘𝑝𝑟𝑖𝑣 = (𝑛, 𝑑)
*Euclid’s or Stein’s algorithm are typically used to compute the GCD.
References
Some light reading on the web
RSA Laboratories: 3.6.1 What is Diffie-Hellman?
David A. Carts: A Review of the Diffie-Hellman Algorithm
and its Use in Secure Internet Protocols.
RSA Laboratories: What is the RSA Cryptosystem?
RSA Laboratories: RSA Factoring Challenge.
BigPrimes.net: Prime Numbers Archive.

More Related Content

Similar to keyex.pptx

Introduction to cryptography part2-final
Introduction to cryptography  part2-finalIntroduction to cryptography  part2-final
Introduction to cryptography part2-finalTaymoor Nazmy
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key SignaturesDavid Evans
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.pptMIBrand
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.pptShounakDas16
 
Threshold Cryptography and Distributed Key Generation
Threshold Cryptography and Distributed Key GenerationThreshold Cryptography and Distributed Key Generation
Threshold Cryptography and Distributed Key GenerationLeonid Beder
 
Simple Overview Caesar and RSA Encryption_by_Tarek_Gaber
Simple Overview Caesar and RSA Encryption_by_Tarek_GaberSimple Overview Caesar and RSA Encryption_by_Tarek_Gaber
Simple Overview Caesar and RSA Encryption_by_Tarek_GaberTarek Gaber
 
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPALPROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPALDrupalCamp Kyiv
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic CurvesSam Bowne
 
Machine Learning on Azure - AzureConf
Machine Learning on Azure - AzureConfMachine Learning on Azure - AzureConf
Machine Learning on Azure - AzureConfSeth Juarez
 
Cs166 mynote
Cs166 mynoteCs166 mynote
Cs166 mynoteKaya Ota
 
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...44CON
 
HifnCrypto101
HifnCrypto101HifnCrypto101
HifnCrypto101Jim Faith
 
Cryptography for software engineers
Cryptography for software engineersCryptography for software engineers
Cryptography for software engineersJas Chhabra
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptxSurendraBasnet6
 
Cryptography for developers
Cryptography for developersCryptography for developers
Cryptography for developersKai Koenig
 
CNIT 141 12. Elliptic Curves
CNIT 141 12. Elliptic CurvesCNIT 141 12. Elliptic Curves
CNIT 141 12. Elliptic CurvesSam Bowne
 

Similar to keyex.pptx (20)

Introduction to cryptography part2-final
Introduction to cryptography  part2-finalIntroduction to cryptography  part2-final
Introduction to cryptography part2-final
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.ppt
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.ppt
 
Threshold Cryptography and Distributed Key Generation
Threshold Cryptography and Distributed Key GenerationThreshold Cryptography and Distributed Key Generation
Threshold Cryptography and Distributed Key Generation
 
暗認本読書会6
暗認本読書会6暗認本読書会6
暗認本読書会6
 
Simple Overview Caesar and RSA Encryption_by_Tarek_Gaber
Simple Overview Caesar and RSA Encryption_by_Tarek_GaberSimple Overview Caesar and RSA Encryption_by_Tarek_Gaber
Simple Overview Caesar and RSA Encryption_by_Tarek_Gaber
 
Cryptography
CryptographyCryptography
Cryptography
 
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPALPROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
Diffie-hellman algorithm
Diffie-hellman algorithmDiffie-hellman algorithm
Diffie-hellman algorithm
 
Machine Learning on Azure - AzureConf
Machine Learning on Azure - AzureConfMachine Learning on Azure - AzureConf
Machine Learning on Azure - AzureConf
 
Cs166 mynote
Cs166 mynoteCs166 mynote
Cs166 mynote
 
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
 
HifnCrypto101
HifnCrypto101HifnCrypto101
HifnCrypto101
 
Security.ppt
Security.pptSecurity.ppt
Security.ppt
 
Cryptography for software engineers
Cryptography for software engineersCryptography for software engineers
Cryptography for software engineers
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
Cryptography for developers
Cryptography for developersCryptography for developers
Cryptography for developers
 
CNIT 141 12. Elliptic Curves
CNIT 141 12. Elliptic CurvesCNIT 141 12. Elliptic Curves
CNIT 141 12. Elliptic Curves
 

Recently uploaded

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 

keyex.pptx

  • 1. Key Exchange Methods Diffie-Hellman and RSA CPE 701 Research Case Study Derek Eiler | April 2012
  • 2. Overview Today’s discussion • Background: “key” cryptography concepts • Diffie-Hellman key exchange • Public key infrastructure (PKI) • RSA key pair generation
  • 3. Background A few “key” concepts • Encryption: plaintext -> ciphertext • Decryption: ciphertext -> plaintext • Cryptographic function: mathematical function or algorithm used to encrypt/decrypt • Key: parameter for a cryptographic function • Symmetric vs. asymmetric keys
  • 4. So four people walk into a bar… Alice, Bob, Eve, and Mallory • Alice and Bob want to speak privately over a public channel • Eve is always eavesdropping on Alice and Bob • Mallory has malicious plans to interfere with Alice and Bob’s private conversation
  • 5. Diffie-Hellman key exchange The concept • Alice and Bob derive a shared secret key over a public channel (no prior arrangements) • Publicly agree on two public values, 𝑝 and 𝑔 • Each choose a private value, 𝑎 and 𝑏 • Use clever math to compute a shared secret, 𝑘 • Eve and Mallory never overhear enough information to derive the shared secret
  • 6. Diffie-Hellman key exchange The math: discrete logarithm problem Let 𝑝 be a large prime number Let 𝑔 be an integer < 𝑝 For every number 𝑛 from 1 … 𝑝 − 1 , inclusive, 𝑔 must have a power 𝑘 such that: 𝑛 = 𝑔𝑘 mod 𝑝 • Solving the 𝑘𝑡ℎ root mod 𝑝 is considered (but not proven) hard to do in polynomial time
  • 7. Diffie-Hellman key exchange The math: discrete logarithm in action Solve for 𝑘, given values 𝑝, 𝑔, 𝑎′, 𝑏′ and knowing: 𝑘 = 𝑔𝑎𝑏 = 𝑔𝑏𝑎 𝑎′ = 𝑔𝑎 mod 𝑝 𝑏′ = 𝑔𝑏 mod 𝑝 𝑘 = (𝑏′)𝑎 mod 𝑝 𝑘 = (𝑎′)𝑏 mod 𝑝 • Finding 𝑘 is easy if 𝑎 or 𝑏 are known • Quickly solved by brute force if 𝑝 = 3 and 𝑔 = 2 • What if 𝑝 = 6,461,333,867 and 𝑔 = 3,691?
  • 8. Diffie-Hellman key exchange Example using small numbers Alice starts the exchange and tells Bob 𝑝 = 7, 𝑔 = 1 Privately, Alice chooses 𝑎 = 3 and Bob chooses 𝑏 = 5 Alice computes 𝑎′ = 𝑔𝑎 mod 𝑝 and tells Bob the result 𝑎′ = 23 mod 7 = 1 Bob computes 𝑏′ = 𝑔𝑏 mod 𝑝 and tells Alice the result 𝑏′ = 25 mod 7 = 4 Since k = 𝑔𝑏𝑎 , Alice can compute 𝑘 = (𝑏′)𝑎 mod 𝑝 𝑘 = (4)3 mod 7 = 1 Since k = 𝑔𝑎𝑏 , Bob can compute 𝑘 = (𝑎′)𝑏 mod 𝑝 𝑘 = (1)5 mod 7 = 1 Meanwhile, Eve doesn’t know 𝑎 or 𝑏 and can’t easily derive 𝑘
  • 9. RSA key generation The concept • Alice generates a pair of keys, publishing one and keeping the other private • Anyone may use the published key to encrypt messages intended for Alice • Only Alice can decrypt messages encrypted with the public key (unless the private key was compromised somehow) • Alice may also use the key pair to prove her identity
  • 10. RSA key generation The math: factoring problem • Computing the product of two prime numbers is easy (23*17 = 391) • Factoring the product of two large prime numbers is “hard” • Try factoring 123,018,668,453,011,775,513,049,495,838,496,2 72,077,285,356,959,533,479,219,732,245,215,17 2,640,050,726,365,751,874,520,219,978,646,938 ,995,647,494,277,406,384,592,519,255,732,630, 345,373,154,826,850,791,702,612,214,291,346,1 67,042,921,431,160,222,124,047,927,473,779,40 8,066,535,141,959,745,986,902,143,413
  • 11. RSA key generation The math: public and private key pair • Calculate the product 𝑛 = 𝑝𝑞 where 𝑝 and 𝑞 are very large prime numbers (e.g. tens or even hundreds of digits long) • Carefully choose exponents 𝑒 and 𝑑 such that we can publish the key 𝑘𝑝𝑢𝑏 = (𝑛, 𝑒) and retain the corresponding private key 𝑘𝑝𝑟𝑖𝑣 = (𝑛, 𝑑)
  • 12. RSA key generation The math: “exponential” difficulty • Choose an 𝑒 such that 𝑒 < 𝑛 and 𝑒 is coprime to 𝑝 − 1 𝑞 − 1 • How? For each 𝑒 in {2 … 𝑝𝑞}, test whether GCD 𝑒, 𝑝 − 1 𝑞 − 1 = 1 until true.* • Choose a 𝑑 such that 𝑒𝑑 − 1 is divisible by 𝑝 − 1 𝑞 − 1 • Now publish 𝑘𝑝𝑢𝑏 = (𝑛, 𝑒) and retain the private key 𝑘𝑝𝑟𝑖𝑣 = (𝑛, 𝑑) *Euclid’s or Stein’s algorithm are typically used to compute the GCD.
  • 13. References Some light reading on the web RSA Laboratories: 3.6.1 What is Diffie-Hellman? David A. Carts: A Review of the Diffie-Hellman Algorithm and its Use in Secure Internet Protocols. RSA Laboratories: What is the RSA Cryptosystem? RSA Laboratories: RSA Factoring Challenge. BigPrimes.net: Prime Numbers Archive.