SlideShare a Scribd company logo
$ 7absec
-- Aaftab Harun
(7absec)
$ 7absec
Introduction
Encryption V/S Encoding
Prime & Coprime
Encryption Process
Decryption Process
Conclusion
11:10 AM
11:20 AM
11:30 AM
11:40 AM
12:10 PM
12:20 PM
$ 7absec
Asymmetric cryptography, also known as public-key cryptography, is a process that
uses a pair of related keys -- one public key and one private key -- to encrypt and
decrypt a message and protect it from unauthorized access or use.
$ 7absec
$ 7absec
RSA is an asymmetric public-key encryption system that is very commonly
used in real world applications.
The RSA Encryption algorithm is based primarily around the concept
of Coprimality.
$ 7absec
https://media.geeksforgeeks.org/wp-content/uploads/20200428143327/RSA.png
$ 7absec
p = A prime number
q = A prime number
n = p * q
φ = (p - 1) * (q - 1)
e = public Key
d = Private Key
m = Message ( to encrypt/decrypt)
=== Co-prime Number
$ 7absec
• A Number that is only divisible by 1 and the number itself
• For instance 2,3,5,7,11, …
Walk Through
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
• Two numbers having 1 as greatest common divisor (gcd)
• For instance 11 & 13, 8 & 15 etc
Walk Through
1: Prime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
• RSA Key generation starts with two prime numbers.
• These can be randomly selected or otherwise — they
just have to be prime.
• P = 11
• Q = 13
Walk Through
1: Prime Number
2: Coprime Number
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
• N is simply p and q multiplied together.
• n = p * q = 11 * 13 = 143
• Phi is the number of integers that are coprime to n
• phi = (p-1) * (q-1) = (11-1) * (13-1) = 120
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
5: Progress upto this
6: Finding “e”
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
RSA Encryption
• p = 11
• q = 13
• n = 143
• phi = 120
• e?
• d?
• m =“?”
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
6: Finding “e”
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
• A number that is less than phi, and coprime to both n
and phi.
• The key should be greater than 2 and less than phi
(2<e<phi)
• n = 143
• phi = 120
• possible_bup_keys = []
• for i in range(2, phi):
• if gcd(n, i) == 1 and gcd (phi, i) == 1:
• possible_bup_keys.append(i)
• Print(possible_bup_keys)
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
• A number that is grater than phi
• d*e mod phi = 1 or d*e % phi = 1
• phi = 120
• e = 7
• possible_pvt_keys = []
• for i in range(phi + 1, phi + 1000):
• if i * e % phi == 1:
• possible_pvt_keys.append(i)
• Print(possible_pvt_keys)
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
8: Progress upto this
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
RSA Encryption
P = 11
q = 13
n = 143
phi = 120
e = 7
d = 223
m= “ Hello”
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
7: Finding “d”
9: Asymmetric Keys
10: Encryption & Decryption
$ 7absec
• Public Key: (e, n)
• Private Key: (d, n)
• Public Key: (7, 143)
• Private Key (223, 143)
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
7: Finding “d”
8: Progress upto this
10: Encryption & Decryption
$ 7absec
• Encryption
• m ** e % n
• Decryption
• enc_m ** d % n
Walk Through
1: Prime Number
2: Coprime Number
3: Assigning values of p & q
4: Calculating n and phi
5: Progress upto this
6: Finding “e”
7: Finding “d”
8: Progress upto this
9: Asymmetric Keys
$ 7absec
• Asymmetric encryption is more secure than symmetric encryption.
$ 7absec
Questions/Suggestions…

More Related Content

Similar to Asymmetric Encryption with RSA

rsa-1
rsa-1rsa-1
RSA Encryption presentation for Education.pptx
RSA Encryption presentation for Education.pptxRSA Encryption presentation for Education.pptx
RSA Encryption presentation for Education.pptx
alihassan99765123
 
CRYPTOGRAPHY (2).pdf
CRYPTOGRAPHY (2).pdfCRYPTOGRAPHY (2).pdf
CRYPTOGRAPHY (2).pdf
BhuvanaR13
 
Ntewrok secuirty cs7
Ntewrok secuirty cs7Ntewrok secuirty cs7
Ntewrok secuirty cs7
Infinity Tech Solutions
 
6-PKCpartII-Encryptionandsignatures.pptx
6-PKCpartII-Encryptionandsignatures.pptx6-PKCpartII-Encryptionandsignatures.pptx
6-PKCpartII-Encryptionandsignatures.pptx
farouqalfuhidi
 
Public Key Cryptosystems and RSA
Public Key Cryptosystems and RSAPublic Key Cryptosystems and RSA
Public Key Cryptosystems and RSA
Chris Theisen
 
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and DecryptionImplementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
Md. Ariful Hoque
 
Introduction to cryptography
Introduction to cryptographyIntroduction to cryptography
Introduction to cryptography
Suresh Thammishetty
 
RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2
Fahad Layth
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
Indra97065
 
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptx
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptxRivest Shamir Adleman Algorithm and its variant : DRSA.pptx
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptx
werip98386
 
CNIT 141: 10. RSA
CNIT 141: 10. RSACNIT 141: 10. RSA
CNIT 141: 10. RSA
Sam Bowne
 
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
Andrew Shitov
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptx
RavikumarVadana
 
Rsa algorithm key generation
Rsa algorithm key generation Rsa algorithm key generation
Rsa algorithm key generation
swarnapatil
 
RSA.pptx
RSA.pptxRSA.pptx
RSA.pptx
mic
 
PKC&RSA
PKC&RSAPKC&RSA
PKC&RSA
Anver S R
 
Class3
Class3Class3
Cryptography & Security
Cryptography & SecurityCryptography & Security
Cryptography & Security
Chanaka Lasantha
 
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
なんとか くら
 

Similar to Asymmetric Encryption with RSA (20)

rsa-1
rsa-1rsa-1
rsa-1
 
RSA Encryption presentation for Education.pptx
RSA Encryption presentation for Education.pptxRSA Encryption presentation for Education.pptx
RSA Encryption presentation for Education.pptx
 
CRYPTOGRAPHY (2).pdf
CRYPTOGRAPHY (2).pdfCRYPTOGRAPHY (2).pdf
CRYPTOGRAPHY (2).pdf
 
Ntewrok secuirty cs7
Ntewrok secuirty cs7Ntewrok secuirty cs7
Ntewrok secuirty cs7
 
6-PKCpartII-Encryptionandsignatures.pptx
6-PKCpartII-Encryptionandsignatures.pptx6-PKCpartII-Encryptionandsignatures.pptx
6-PKCpartII-Encryptionandsignatures.pptx
 
Public Key Cryptosystems and RSA
Public Key Cryptosystems and RSAPublic Key Cryptosystems and RSA
Public Key Cryptosystems and RSA
 
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and DecryptionImplementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
 
Introduction to cryptography
Introduction to cryptographyIntroduction to cryptography
Introduction to cryptography
 
RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
 
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptx
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptxRivest Shamir Adleman Algorithm and its variant : DRSA.pptx
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptx
 
CNIT 141: 10. RSA
CNIT 141: 10. RSACNIT 141: 10. RSA
CNIT 141: 10. RSA
 
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptx
 
Rsa algorithm key generation
Rsa algorithm key generation Rsa algorithm key generation
Rsa algorithm key generation
 
RSA.pptx
RSA.pptxRSA.pptx
RSA.pptx
 
PKC&RSA
PKC&RSAPKC&RSA
PKC&RSA
 
Class3
Class3Class3
Class3
 
Cryptography & Security
Cryptography & SecurityCryptography & Security
Cryptography & Security
 
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
 

Recently uploaded

AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 

Recently uploaded (20)

AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 

Asymmetric Encryption with RSA

  • 1. $ 7absec -- Aaftab Harun (7absec)
  • 2. $ 7absec Introduction Encryption V/S Encoding Prime & Coprime Encryption Process Decryption Process Conclusion 11:10 AM 11:20 AM 11:30 AM 11:40 AM 12:10 PM 12:20 PM
  • 3. $ 7absec Asymmetric cryptography, also known as public-key cryptography, is a process that uses a pair of related keys -- one public key and one private key -- to encrypt and decrypt a message and protect it from unauthorized access or use.
  • 5. $ 7absec RSA is an asymmetric public-key encryption system that is very commonly used in real world applications. The RSA Encryption algorithm is based primarily around the concept of Coprimality.
  • 7. $ 7absec p = A prime number q = A prime number n = p * q φ = (p - 1) * (q - 1) e = public Key d = Private Key m = Message ( to encrypt/decrypt) === Co-prime Number
  • 8. $ 7absec • A Number that is only divisible by 1 and the number itself • For instance 2,3,5,7,11, … Walk Through 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 9. $ 7absec • Two numbers having 1 as greatest common divisor (gcd) • For instance 11 & 13, 8 & 15 etc Walk Through 1: Prime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 10. $ 7absec • RSA Key generation starts with two prime numbers. • These can be randomly selected or otherwise — they just have to be prime. • P = 11 • Q = 13 Walk Through 1: Prime Number 2: Coprime Number 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 11. $ 7absec • N is simply p and q multiplied together. • n = p * q = 11 * 13 = 143 • Phi is the number of integers that are coprime to n • phi = (p-1) * (q-1) = (11-1) * (13-1) = 120 Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 5: Progress upto this 6: Finding “e” 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 12. $ 7absec RSA Encryption • p = 11 • q = 13 • n = 143 • phi = 120 • e? • d? • m =“?” Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 6: Finding “e” 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 13. $ 7absec • A number that is less than phi, and coprime to both n and phi. • The key should be greater than 2 and less than phi (2<e<phi) • n = 143 • phi = 120 • possible_bup_keys = [] • for i in range(2, phi): • if gcd(n, i) == 1 and gcd (phi, i) == 1: • possible_bup_keys.append(i) • Print(possible_bup_keys) Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 14. $ 7absec • A number that is grater than phi • d*e mod phi = 1 or d*e % phi = 1 • phi = 120 • e = 7 • possible_pvt_keys = [] • for i in range(phi + 1, phi + 1000): • if i * e % phi == 1: • possible_pvt_keys.append(i) • Print(possible_pvt_keys) Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 8: Progress upto this 9: Asymmetric Keys 10: Encryption & Decryption
  • 15. $ 7absec RSA Encryption P = 11 q = 13 n = 143 phi = 120 e = 7 d = 223 m= “ Hello” Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 7: Finding “d” 9: Asymmetric Keys 10: Encryption & Decryption
  • 16. $ 7absec • Public Key: (e, n) • Private Key: (d, n) • Public Key: (7, 143) • Private Key (223, 143) Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 7: Finding “d” 8: Progress upto this 10: Encryption & Decryption
  • 17. $ 7absec • Encryption • m ** e % n • Decryption • enc_m ** d % n Walk Through 1: Prime Number 2: Coprime Number 3: Assigning values of p & q 4: Calculating n and phi 5: Progress upto this 6: Finding “e” 7: Finding “d” 8: Progress upto this 9: Asymmetric Keys
  • 18. $ 7absec • Asymmetric encryption is more secure than symmetric encryption.