SlideShare a Scribd company logo
Public Key Cryptography and RSA
© 2017 Pearson Education, Ltd., All rights reserved.
Table 9.1
Terminology Related to Asymmetric Encryption
Source: Glossary of Key Information Security Terms, NIST IR 7298 [KISS06]
© 2017 Pearson Education, Ltd., All rights reserved.
Misconceptions Concerning
Public-Key Encryption
• Public-key encryption is more secure from
cryptanalysis than symmetric encryption
• Public-key encryption is a general-purpose
technique that has made symmetric
encryption obsolete
© 2017 Pearson Education, Ltd., All rights reserved.
• The concept of public-key cryptography evolved from
an attempt to attack two of the most difficult
problems associated with symmetric encryption:
• Whitfield Diffie and Martin Hellman from Stanford
University achieved a breakthrough in 1976 by coming
up with a method that addressed both problems and
was radically different from all previous approaches to
cryptography
Principles of Public-Key
Cryptosystems
• How to have secure communications in general without having to
trust a KDC with your key
Key distribution
• How to verify that a message comes intact from the claimed sender
Digital signatures
© 2017 Pearson Education, Ltd., All rights reserved.
Public-Key Cryptosystems
• A public-key encryption scheme has six ingredients:
Plaintext
The
readable
message
or data
that is fed
into the
algorithm
as input
Encryption
algorithm
Performs
various
transforma-
tions on the
plaintext
Public key
Used for
encryption
or
decryption
Private key
Used for
encryption
or
decryption
Ciphertext
The
scrambled
message
produced
as output
Decryption
algorithm
Accepts
the
ciphertex
t and the
matching
key and
produces
the
original
plaintext
© 2017 Pearson Education, Ltd., All rights reserved.
Comparison of SK and PK
DISTINCT
FEATURES
SECRET KEY PUBLIC KEY
NUMBER OF
KEYS
Single key. Pair of keys.
TYPES OF KEYS Key is secret. One key is
private, and one
key is public.
SIZE OF KEY 50-250 bits 500-2500 bits
RELATIVE
SPEEDS
Faster. Slower.
© 2017 Pearson Education, Ltd., All rights reserved.
Table 9.2
Conventional and Public-Key Encryption
© 2017 Pearson Education, Ltd., All rights reserved.
Public-Key Cryptosystem: Secrecy
© 2017 Pearson Education, Ltd., All rights reserved.
Public-Key Cryptosystem: Authentication
© 2017 Pearson Education, Ltd., All rights reserved.
Public-Key Cryptosystem:
Authentication and Secrecy
© 2017 Pearson Education, Ltd., All rights reserved.
Applications for Public-Key
Cryptosystems
• Public-key cryptosystems can be classified into
three categories:
• Some algorithms are suitable for all three
applications, whereas others can be used only for
one or two
•The sender encrypts a message
with the recipient’s public key
Encryption/decryption
•The sender “signs” a message
with its private key
Digital signature
•Two sides cooperate to
exchange a session key
Key exchange
© 2017 Pearson Education, Ltd., All rights reserved.
Table 9.3
Applications for Public-Key Cryptosystems
Table 9.3 Applications for Public-Key Cryptosystems
© 2017 Pearson Education, Ltd., All rights reserved.
Public-Key Requirements
• Conditions that these algorithms must fulfill:
• It is computationally easy for a party B to generate a pair
(public-key PUb, private key PRb)
• It is computationally easy for a sender A, knowing the
public key and the message to be encrypted, to generate
the corresponding ciphertext
• It is computationally easy for the receiver B to decrypt
the resulting ciphertext using the private key to recover
the original message
• It is computationally infeasible for an adversary, knowing
the public key, to determine the private key
• It is computationally infeasible for an adversary, knowing
the public key and a ciphertext, to recover the original
message
• The two keys can be applied in either order
© 2017 Pearson Education, Ltd., All rights reserved.
Public-Key Requirements
• Need a trap-door one-way function
• A one-way function is one that maps a domain into a range
such that every function value has a unique inverse, with the
condition that the calculation of the function is easy, whereas
the calculation of the inverse is infeasible
• Y = f(X) easy
• X = f–1(Y) infeasible
• A trap-door one-way function is a family of invertible
functions fk, such that
• Y = fk(X) easy, if k and X are known
• X = fk
–1(Y) easy, if k and Y are known
• X = fk
–1(Y) infeasible, if Y known but k not known
• A practical public-key scheme depends on a suitable trap-
door one-way function
© 2017 Pearson Education, Ltd., All rights reserved.
Important Mathematical
Ideas
• Prime Numbers
• Multiplication vs. Factorization
• Greatest Common Divisor/Euclidean Algorithm
• Relatively Prime Numbers
• Modular Arithmetic/Modular Inverse
• Euler’s Theorem
• Multiplicative functions
Prime Numbers ...
• A prime number, or prime, is a number that is
evenly divisible by only 1 and itself.
• For instance 10 is not prime because it is evenly
divisible by 1, 2, 5 and 10. But 11 is prime, since
only 1 and 11 evenly divide it.
• The numbers that evenly divide another
number are called factors. The process of
finding the factors of a number is called
factoring.
Factoring a Number ...
• For example, factoring 15 is simple, it is 3 * 5.
But what about 6,320,491,217?
• Now how about a 155-digit number? Or 200
digits or more? In short, factoring numbers
takes a certain number of steps, and the
number of steps increases subexponentially as
the size of the number increases. That means
even on supercomputers, if a number is
sufficiently large, the time to execute all the
steps to factor it would be so great that it
could take years to compute.
Relatively Prime
• Two numbers are relatively prime if they
share only one factor, namely 1.
• For example, 10 and 21 are relatively prime.
Neither is prime, but the numbers that
evenly divide 10 are 1, 2, 5 and 10, whereas
the numbers that evenly divide 21 are 1, 3, 7
and 21.
• The only number in both lists is 1, so the
numbers are relatively prime.
Greatest Common
Divisor
• If two numbers are relatively prime their GCD
is 1.
• m and n are relatively prime means gcd(m, n) =
1
• There is a simple algorithm to calculate the gcd
of two integers – Euclidean Algorithm
Example of Euclidean
Algorithm
• Calculate the GCD of 1156 and 112
Divisor Dividend Quotient Remainder
112 1156 10 36
36 112 3 4
4 36 9 0
When you get a
zero remainder,
the remainder
before it is the
GCD
GCD of 1156 and 112
1156 = 22 Ă— 172 = 2 Ă— 2 Ă— 17 Ă— 17
112 = 24 Ă— 71 = 2 Ă— 2 Ă— 2 Ă— 2 Ă— 7
1156
2 578
2 289
17 17
112
2 56
2 28
2 14
2 7
Example of Euclidean
Algorithm
• Calculate the GCD of 2428 and 60
Divisor Dividend Quotient Remainder
60 2428 40 28
28 60 2 4
4 28 7 0
When you get a
zero remainder,
the remainder
before it is the
GCD
Modular Arithmetic
• a = b mod (m) means that when a is divided by
m the remainder is b.
• Examples
• 11 = 1 mod (5)
• 20 = 2 mod (6)
• Modular Math and Prime Numbers
• Prime numbers possess various useful
properties when used in modular math.
• The RSA algorithm takes advantage of these
properties.
Modular Inverse
• Another aspect of modular math is the
concept of a modular inverse.
• Two numbers are the modular inverses of each
other if their product equals 1.
• For instance, 7 * 343 = 2401, but if our modulus
is 2400, the result is:
• (7 * 343) mod 2400 = 2401 – 2400 = 1 mod 2400
Euler’s phi-function
• In the eighteenth century, the mathematician
Leonhard Euler (pronounced “Oiler”)
described j(n) as the number of numbers less
than n that are relatively prime to n.
• The character j is the Greek letter "phi" (in
math circles it rhymes with “tea” in the
academic organization Phi Beta Kappa it
rhymes with “tie”).
• This is known as Euler’s phi-function.
Euler’s phi-function
• So ϕ(6), for instance, is 2, since of all the numbers
less than 6 (1, 2, 3, 4 and 5), only two of them (1 and
5) are relatively prime with 6. The numbers 2 and 4
share with 6 a common factor other than 1, namely
2. And 3 and 6 share 3 as a common factor.
• What about ϕ(7)? Because 7 is prime, its only
factors are 1 and 7. Hence, any number less than 7
can share with 7 only 1 as a common factor.
Without even examining those numbers less than 7,
we know they are all relatively prime with 7. Since
there are 6 numbers less than 7, Ď•(7) = 6. Clearly
this result will extend to all prime numbers.
Namely, if p is prime, Ď•(p) = (p - 1).
Exponentiation
• Exponentiation is taking numbers to powers,
such as 23, which is 2 * 2 * 2 = 8. In this
example, 2 is known as the base and 3 is the
exponent. There are some useful algebraic
identities in exponentiation.
• (bx) * (by) = bx+y
• (bx)y = bxy
Exponential Period
modulo n
• Euler noticed that ϕ(n) was the “exponential
period” modulo n for numbers relatively prime
with n.
• What that means is that for any number a < n, if
a is relatively prime with n, a Ď•(n) mod n = 1.
• So if you multiply a by itself ϕ(n) times, modulo
n, the result is 1. Then if you multiply by a one
more time, you are finding the product of 1 * a
which is a, so you are starting over again.
• Hence, a ϕ(n) *a = a ϕ(n)+1 mod n = a.
Exponential Period
modulo n
• For example, if n is 5 (a prime number), then
Ď•(5) = 4. Let a be 3 and compute
• a ϕ(n) mod n = 34 = 3 * 3 * 3 * 3 mod 5
• = 81 mod 5
• = 1 mod 5
Rivest-Shamir-Adleman
(RSA) Algorithm
• Developed in 1977 at MIT by Ron Rivest, Adi
Shamir & Len Adleman
• Most widely used general-purpose approach
to public-key encryption
• Is a cipher in which the plaintext and
ciphertext are integers between 0 and n – 1 for
some n
• A typical size for n is 1024 bits, or 309 decimal
digits
© 2017 Pearson Education, Ltd., All rights reserved.
RSA Algorithm
• RSA makes use of an expression with exponentials
• Plaintext is encrypted in blocks with each block having a binary
value less than some number n
• Encryption and decryption are of the following form, for some
plaintext block M and ciphertext block C
C = Me mod n
M = Cd mod n = (Me)d mod n = Med mod n
• Both sender and receiver must know the value of n
• The sender knows the value of e, and only the receiver knows the
value of d
• This is a public-key encryption algorithm with a public key of
PU={e,n} and a private key of PR={d,n}
© 2017 Pearson Education, Ltd., All rights reserved.
Algorithm Requirements
• For this algorithm to be satisfactory for public-
key encryption, the following requirements
must be met:
1. It is possible to find values of e, d, n
such that Med mod n = M for all M < n
2. It is relatively easy to calculate Me mod
n and Cd mod n for all values of M < n
3. It is infeasible to determine d given e
and n
© 2017 Pearson Education, Ltd., All rights reserved.
© 2017 Pearson Education, Ltd., All rights reserved.
RSA Example
• p = 3
• q = 11
• n = p × q = 33 -- This is the modulus
• z = (p-1) × (q -1) = 20 -- This is the totient function φ(n). There are 20 relative primes to 33.
What are they? 1, 2, 4, 5, 7, 8, 10, 13, 14, 16, 17, 19, 20, 23, 25, 26, 28, 29, 31, 32
• d = 7 -- 7 and 20 have no common factors but 1
• 7e = 1 mod 20
• e = 3
• C = Me (mod n)
• M = Cd (mod n)
RSA Example
Plaintext (M) Ciphertext (C) After Decryption
Symbolic Numeric Me Me(mod n) Cd Cd (mod n) Symbolic
S 19 6859 28 13492928512 19 S
U 21 9261 21 1801088541 21 U
Z 26 17576 20 1280000000 26 Z
A 01 1 1 1 01 A
N 14 2744 5 78125 14 N
N 14 2744 5 78125 14 N
E 05 125 26 8031810176 05 E
RSA Example - Key Setup
1. Select primes: p=17 & q=11
2. Compute n = pq =17 x 11=187
3. Compute ø(n)=(p–1)(q-1)=16 x 10=160
4. Select e: gcd(e,160)=1; choose e=7
5. Determine d: de=1 mod 160 and d < 160 Value
is d=23 since 23x7=161= 10x160+1
6. Publish public key PU={7,187}
7. Keep secret private key PR={23,187}
RSA Example -
En/Decryption
• sample RSA encryption/decryption is:
• given message M = 88 (nb. 88<187)
• encryption:
C = 887 mod 187 = 11
• decryption:
M = 1123 mod 187 = 88
© 2017 Pearson Education, Ltd., All rights reserved.

More Related Content

Similar to Public Key and RSA.pdf

Ch9
Ch9Ch9
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
Sathish Kumar
 
11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf
VipinNegi38
 
CH4__crypto.pptx
CH4__crypto.pptxCH4__crypto.pptx
CH4__crypto.pptx
Mohammad512578
 
CNIT 141 10. RSA
CNIT 141 10. RSACNIT 141 10. RSA
CNIT 141 10. RSA
Sam Bowne
 
Information and network security 34 primality
Information and network security 34 primalityInformation and network security 34 primality
Information and network security 34 primality
Vaibhav Khanna
 
Class3
Class3Class3
Class3
ankitasinghbsc
 
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsDiscrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
NIT Sikkim
 
Number theory and cryptography
Number theory and cryptographyNumber theory and cryptography
Number theory and cryptography
Yasser Ali
 
Unit 3
Unit 3Unit 3
Unit 3
KRAMANJANEYULU1
 
Senior Research Final Draft3
Senior Research Final Draft3Senior Research Final Draft3
Senior Research Final Draft3
Coleman Gorham
 
Prime Numbers and Their Digital Roots
Prime Numbers and Their Digital RootsPrime Numbers and Their Digital Roots
Prime Numbers and Their Digital Roots
IRJET Journal
 
The RSA Algorithm Explored
The RSA Algorithm ExploredThe RSA Algorithm Explored
The RSA Algorithm Explored
AM Publications,India
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
rameshvvv
 
CNIT 141 10. RSA
CNIT 141 10. RSACNIT 141 10. RSA
CNIT 141 10. RSA
Sam Bowne
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptx
RavikumarVadana
 
Rsa
RsaRsa
Rsa
magentie
 
Cryptography and RSA algorithm
Cryptography and RSA algorithmCryptography and RSA algorithm
Cryptography and RSA algorithm
Saifil Momin
 
Assignment 2 (1) (1).docx
Assignment 2 (1) (1).docxAssignment 2 (1) (1).docx
Assignment 2 (1) (1).docx
pinstechwork
 
CNIT 141: 10. RSA
CNIT 141: 10. RSACNIT 141: 10. RSA
CNIT 141: 10. RSA
Sam Bowne
 

Similar to Public Key and RSA.pdf (20)

Ch9
Ch9Ch9
Ch9
 
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
 
11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf
 
CH4__crypto.pptx
CH4__crypto.pptxCH4__crypto.pptx
CH4__crypto.pptx
 
CNIT 141 10. RSA
CNIT 141 10. RSACNIT 141 10. RSA
CNIT 141 10. RSA
 
Information and network security 34 primality
Information and network security 34 primalityInformation and network security 34 primality
Information and network security 34 primality
 
Class3
Class3Class3
Class3
 
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsDiscrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
 
Number theory and cryptography
Number theory and cryptographyNumber theory and cryptography
Number theory and cryptography
 
Unit 3
Unit 3Unit 3
Unit 3
 
Senior Research Final Draft3
Senior Research Final Draft3Senior Research Final Draft3
Senior Research Final Draft3
 
Prime Numbers and Their Digital Roots
Prime Numbers and Their Digital RootsPrime Numbers and Their Digital Roots
Prime Numbers and Their Digital Roots
 
The RSA Algorithm Explored
The RSA Algorithm ExploredThe RSA Algorithm Explored
The RSA Algorithm Explored
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
 
CNIT 141 10. RSA
CNIT 141 10. RSACNIT 141 10. RSA
CNIT 141 10. RSA
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptx
 
Rsa
RsaRsa
Rsa
 
Cryptography and RSA algorithm
Cryptography and RSA algorithmCryptography and RSA algorithm
Cryptography and RSA algorithm
 
Assignment 2 (1) (1).docx
Assignment 2 (1) (1).docxAssignment 2 (1) (1).docx
Assignment 2 (1) (1).docx
 
CNIT 141: 10. RSA
CNIT 141: 10. RSACNIT 141: 10. RSA
CNIT 141: 10. RSA
 

Recently uploaded

Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
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
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
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
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
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
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
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
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
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
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 

Recently uploaded (20)

Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
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
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
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
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
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
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
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
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
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
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 

Public Key and RSA.pdf

  • 1. Public Key Cryptography and RSA © 2017 Pearson Education, Ltd., All rights reserved.
  • 2. Table 9.1 Terminology Related to Asymmetric Encryption Source: Glossary of Key Information Security Terms, NIST IR 7298 [KISS06] © 2017 Pearson Education, Ltd., All rights reserved.
  • 3. Misconceptions Concerning Public-Key Encryption • Public-key encryption is more secure from cryptanalysis than symmetric encryption • Public-key encryption is a general-purpose technique that has made symmetric encryption obsolete © 2017 Pearson Education, Ltd., All rights reserved.
  • 4. • The concept of public-key cryptography evolved from an attempt to attack two of the most difficult problems associated with symmetric encryption: • Whitfield Diffie and Martin Hellman from Stanford University achieved a breakthrough in 1976 by coming up with a method that addressed both problems and was radically different from all previous approaches to cryptography Principles of Public-Key Cryptosystems • How to have secure communications in general without having to trust a KDC with your key Key distribution • How to verify that a message comes intact from the claimed sender Digital signatures © 2017 Pearson Education, Ltd., All rights reserved.
  • 5. Public-Key Cryptosystems • A public-key encryption scheme has six ingredients: Plaintext The readable message or data that is fed into the algorithm as input Encryption algorithm Performs various transforma- tions on the plaintext Public key Used for encryption or decryption Private key Used for encryption or decryption Ciphertext The scrambled message produced as output Decryption algorithm Accepts the ciphertex t and the matching key and produces the original plaintext © 2017 Pearson Education, Ltd., All rights reserved.
  • 6. Comparison of SK and PK DISTINCT FEATURES SECRET KEY PUBLIC KEY NUMBER OF KEYS Single key. Pair of keys. TYPES OF KEYS Key is secret. One key is private, and one key is public. SIZE OF KEY 50-250 bits 500-2500 bits RELATIVE SPEEDS Faster. Slower.
  • 7. © 2017 Pearson Education, Ltd., All rights reserved.
  • 8. Table 9.2 Conventional and Public-Key Encryption © 2017 Pearson Education, Ltd., All rights reserved.
  • 9. Public-Key Cryptosystem: Secrecy © 2017 Pearson Education, Ltd., All rights reserved.
  • 10. Public-Key Cryptosystem: Authentication © 2017 Pearson Education, Ltd., All rights reserved.
  • 11. Public-Key Cryptosystem: Authentication and Secrecy © 2017 Pearson Education, Ltd., All rights reserved.
  • 12. Applications for Public-Key Cryptosystems • Public-key cryptosystems can be classified into three categories: • Some algorithms are suitable for all three applications, whereas others can be used only for one or two •The sender encrypts a message with the recipient’s public key Encryption/decryption •The sender “signs” a message with its private key Digital signature •Two sides cooperate to exchange a session key Key exchange © 2017 Pearson Education, Ltd., All rights reserved.
  • 13. Table 9.3 Applications for Public-Key Cryptosystems Table 9.3 Applications for Public-Key Cryptosystems © 2017 Pearson Education, Ltd., All rights reserved.
  • 14. Public-Key Requirements • Conditions that these algorithms must fulfill: • It is computationally easy for a party B to generate a pair (public-key PUb, private key PRb) • It is computationally easy for a sender A, knowing the public key and the message to be encrypted, to generate the corresponding ciphertext • It is computationally easy for the receiver B to decrypt the resulting ciphertext using the private key to recover the original message • It is computationally infeasible for an adversary, knowing the public key, to determine the private key • It is computationally infeasible for an adversary, knowing the public key and a ciphertext, to recover the original message • The two keys can be applied in either order © 2017 Pearson Education, Ltd., All rights reserved.
  • 15. Public-Key Requirements • Need a trap-door one-way function • A one-way function is one that maps a domain into a range such that every function value has a unique inverse, with the condition that the calculation of the function is easy, whereas the calculation of the inverse is infeasible • Y = f(X) easy • X = f–1(Y) infeasible • A trap-door one-way function is a family of invertible functions fk, such that • Y = fk(X) easy, if k and X are known • X = fk –1(Y) easy, if k and Y are known • X = fk –1(Y) infeasible, if Y known but k not known • A practical public-key scheme depends on a suitable trap- door one-way function © 2017 Pearson Education, Ltd., All rights reserved.
  • 16. Important Mathematical Ideas • Prime Numbers • Multiplication vs. Factorization • Greatest Common Divisor/Euclidean Algorithm • Relatively Prime Numbers • Modular Arithmetic/Modular Inverse • Euler’s Theorem • Multiplicative functions
  • 17. Prime Numbers ... • A prime number, or prime, is a number that is evenly divisible by only 1 and itself. • For instance 10 is not prime because it is evenly divisible by 1, 2, 5 and 10. But 11 is prime, since only 1 and 11 evenly divide it. • The numbers that evenly divide another number are called factors. The process of finding the factors of a number is called factoring.
  • 18. Factoring a Number ... • For example, factoring 15 is simple, it is 3 * 5. But what about 6,320,491,217? • Now how about a 155-digit number? Or 200 digits or more? In short, factoring numbers takes a certain number of steps, and the number of steps increases subexponentially as the size of the number increases. That means even on supercomputers, if a number is sufficiently large, the time to execute all the steps to factor it would be so great that it could take years to compute.
  • 19. Relatively Prime • Two numbers are relatively prime if they share only one factor, namely 1. • For example, 10 and 21 are relatively prime. Neither is prime, but the numbers that evenly divide 10 are 1, 2, 5 and 10, whereas the numbers that evenly divide 21 are 1, 3, 7 and 21. • The only number in both lists is 1, so the numbers are relatively prime.
  • 20. Greatest Common Divisor • If two numbers are relatively prime their GCD is 1. • m and n are relatively prime means gcd(m, n) = 1 • There is a simple algorithm to calculate the gcd of two integers – Euclidean Algorithm
  • 21. Example of Euclidean Algorithm • Calculate the GCD of 1156 and 112 Divisor Dividend Quotient Remainder 112 1156 10 36 36 112 3 4 4 36 9 0 When you get a zero remainder, the remainder before it is the GCD
  • 22. GCD of 1156 and 112 1156 = 22 Ă— 172 = 2 Ă— 2 Ă— 17 Ă— 17 112 = 24 Ă— 71 = 2 Ă— 2 Ă— 2 Ă— 2 Ă— 7 1156 2 578 2 289 17 17 112 2 56 2 28 2 14 2 7
  • 23. Example of Euclidean Algorithm • Calculate the GCD of 2428 and 60 Divisor Dividend Quotient Remainder 60 2428 40 28 28 60 2 4 4 28 7 0 When you get a zero remainder, the remainder before it is the GCD
  • 24. Modular Arithmetic • a = b mod (m) means that when a is divided by m the remainder is b. • Examples • 11 = 1 mod (5) • 20 = 2 mod (6) • Modular Math and Prime Numbers • Prime numbers possess various useful properties when used in modular math. • The RSA algorithm takes advantage of these properties.
  • 25. Modular Inverse • Another aspect of modular math is the concept of a modular inverse. • Two numbers are the modular inverses of each other if their product equals 1. • For instance, 7 * 343 = 2401, but if our modulus is 2400, the result is: • (7 * 343) mod 2400 = 2401 – 2400 = 1 mod 2400
  • 26. Euler’s phi-function • In the eighteenth century, the mathematician Leonhard Euler (pronounced “Oiler”) described j(n) as the number of numbers less than n that are relatively prime to n. • The character j is the Greek letter "phi" (in math circles it rhymes with “tea” in the academic organization Phi Beta Kappa it rhymes with “tie”). • This is known as Euler’s phi-function.
  • 27. Euler’s phi-function • So Ď•(6), for instance, is 2, since of all the numbers less than 6 (1, 2, 3, 4 and 5), only two of them (1 and 5) are relatively prime with 6. The numbers 2 and 4 share with 6 a common factor other than 1, namely 2. And 3 and 6 share 3 as a common factor. • What about Ď•(7)? Because 7 is prime, its only factors are 1 and 7. Hence, any number less than 7 can share with 7 only 1 as a common factor. Without even examining those numbers less than 7, we know they are all relatively prime with 7. Since there are 6 numbers less than 7, Ď•(7) = 6. Clearly this result will extend to all prime numbers. Namely, if p is prime, Ď•(p) = (p - 1).
  • 28.
  • 29. Exponentiation • Exponentiation is taking numbers to powers, such as 23, which is 2 * 2 * 2 = 8. In this example, 2 is known as the base and 3 is the exponent. There are some useful algebraic identities in exponentiation. • (bx) * (by) = bx+y • (bx)y = bxy
  • 30. Exponential Period modulo n • Euler noticed that Ď•(n) was the “exponential period” modulo n for numbers relatively prime with n. • What that means is that for any number a < n, if a is relatively prime with n, a Ď•(n) mod n = 1. • So if you multiply a by itself Ď•(n) times, modulo n, the result is 1. Then if you multiply by a one more time, you are finding the product of 1 * a which is a, so you are starting over again. • Hence, a Ď•(n) *a = a Ď•(n)+1 mod n = a.
  • 31. Exponential Period modulo n • For example, if n is 5 (a prime number), then Ď•(5) = 4. Let a be 3 and compute • a Ď•(n) mod n = 34 = 3 * 3 * 3 * 3 mod 5 • = 81 mod 5 • = 1 mod 5
  • 32. Rivest-Shamir-Adleman (RSA) Algorithm • Developed in 1977 at MIT by Ron Rivest, Adi Shamir & Len Adleman • Most widely used general-purpose approach to public-key encryption • Is a cipher in which the plaintext and ciphertext are integers between 0 and n – 1 for some n • A typical size for n is 1024 bits, or 309 decimal digits © 2017 Pearson Education, Ltd., All rights reserved.
  • 33. RSA Algorithm • RSA makes use of an expression with exponentials • Plaintext is encrypted in blocks with each block having a binary value less than some number n • Encryption and decryption are of the following form, for some plaintext block M and ciphertext block C C = Me mod n M = Cd mod n = (Me)d mod n = Med mod n • Both sender and receiver must know the value of n • The sender knows the value of e, and only the receiver knows the value of d • This is a public-key encryption algorithm with a public key of PU={e,n} and a private key of PR={d,n} © 2017 Pearson Education, Ltd., All rights reserved.
  • 34. Algorithm Requirements • For this algorithm to be satisfactory for public- key encryption, the following requirements must be met: 1. It is possible to find values of e, d, n such that Med mod n = M for all M < n 2. It is relatively easy to calculate Me mod n and Cd mod n for all values of M < n 3. It is infeasible to determine d given e and n © 2017 Pearson Education, Ltd., All rights reserved.
  • 35. © 2017 Pearson Education, Ltd., All rights reserved.
  • 36. RSA Example • p = 3 • q = 11 • n = p Ă— q = 33 -- This is the modulus • z = (p-1) Ă— (q -1) = 20 -- This is the totient function φ(n). There are 20 relative primes to 33. What are they? 1, 2, 4, 5, 7, 8, 10, 13, 14, 16, 17, 19, 20, 23, 25, 26, 28, 29, 31, 32 • d = 7 -- 7 and 20 have no common factors but 1 • 7e = 1 mod 20 • e = 3 • C = Me (mod n) • M = Cd (mod n)
  • 37. RSA Example Plaintext (M) Ciphertext (C) After Decryption Symbolic Numeric Me Me(mod n) Cd Cd (mod n) Symbolic S 19 6859 28 13492928512 19 S U 21 9261 21 1801088541 21 U Z 26 17576 20 1280000000 26 Z A 01 1 1 1 01 A N 14 2744 5 78125 14 N N 14 2744 5 78125 14 N E 05 125 26 8031810176 05 E
  • 38. RSA Example - Key Setup 1. Select primes: p=17 & q=11 2. Compute n = pq =17 x 11=187 3. Compute ø(n)=(p–1)(q-1)=16 x 10=160 4. Select e: gcd(e,160)=1; choose e=7 5. Determine d: de=1 mod 160 and d < 160 Value is d=23 since 23x7=161= 10x160+1 6. Publish public key PU={7,187} 7. Keep secret private key PR={23,187}
  • 39. RSA Example - En/Decryption • sample RSA encryption/decryption is: • given message M = 88 (nb. 88<187) • encryption: C = 887 mod 187 = 11 • decryption: M = 1123 mod 187 = 88
  • 40.
  • 41.
  • 42. © 2017 Pearson Education, Ltd., All rights reserved.