0% found this document useful (0 votes)
32 views12 pages

Lecture 8 RSA Encryption 28032023 023430pm

The document discusses asymmetric cryptography and the RSA algorithm. It explains that RSA uses a public and private key pair based on the mathematical concept of trapdoor functions, where multiplication of two large prime numbers is easy but factoring their product is very difficult. The document provides an example of how RSA encryption and decryption works using a public key to encrypt a message and a private key to decrypt it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views12 pages

Lecture 8 RSA Encryption 28032023 023430pm

The document discusses asymmetric cryptography and the RSA algorithm. It explains that RSA uses a public and private key pair based on the mathematical concept of trapdoor functions, where multiplication of two large prime numbers is easy but factoring their product is very difficult. The document provides an example of how RSA encryption and decryption works using a public key to encrypt a message and a private key to decrypt it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Bahria University

Karachi Campus
Department of Computer Science

By : MUHAMMAD IQBAL
Assistant Professor
Department of Computer Science
BAHRIA UNIVERSITY ,Karachi Campus

Information Security
Spring 2023
Objectives
 Asymmetric Cryptography
 RSA working
 Trapdoor Function

2
Secret Key Public Key
(Symmetric) (Asymmetric)
• 1 Key = encrypt & decrypt • Two separate keys
▫ Advantage: Fast ▫ 1 public key to encrypt
▫ Disadvantage: Not safe ▫ 1 private key to decrypt
RSA Encryption
• Rivest, Ron
Shamir, Adi
Adleman, Leonard

• Most commonly used cryptosystem

• “Trap door function”


In theoretical computer science and
cryptography, a trapdoor function is a
function that is easy to compute in one
direction, yet difficult to compute in the
opposite direction (finding its inverse)
without special information, called the
"trapdoor".
Trapdoor Function
An example of a simple mathematical
trapdoor is "6895601 is the product of two
prime numbers.
However, if one is told that 1931 is one of
the numbers, one can find the answer by
entering "6895601 ÷ 1931" into any
calculator.
Prime Numbers
• Given two large prime numbers, p and q, we
already know:
▫ Simple: Find product N, where N= p*q
▫ Difficult: Factor N, when p and q are unknown

Easy
439 * 541 = 237499
Hard
283 * 719 = 203477
Generating Keys
Public Key Private Key

• Let n = p* q • Choose two large prime


integers p,q

• Find Φ(n)=Φ(pq)
• Choose e such that
=Φ(p)*Φ(q)= (p-1)(q-1)
gcd(e, Φ(n))=1
• Find d such that d is
multiplicative inverse of
e(modΦ(n))

▫ de ≣ 1(mod Φ(n))
M = Plaintext C = Ciphertext
p,q = prime #’s n = p*q
e: gcd(e, Φ(n))=1 d: de ≣ 1(mod Φ(n))

• Encryption Function: E(M)  M e (mod n)

• Decryption Function: D(C)  C d (mod n)





Example
• Message: “Hi” = 89
• p = 11 q = 13
• n = 11 * 13 = 143
• Φ(143) = (11 – 1)(13 – 1) = 120
• Set e = 7
• d = 103
Public Key Secret Key
n = 143 p = 11 p = 13
e=7 Φ(n) = 120 d = 103

Hi = 89 D  C d (mod n)
E  M e (mod n) 67103 (mod143)  89
89 7 (mod143)  67 89 = Hi

 

89
67
Hi
67
Hi

Bob Alice
Many values of n have over 200 digits, making the RSA algorithm nearly unbreakable.

Conclusion
• Security relies on difficulty of factoring large #’s
Many values of n have over 200 digits, making the RSA algorithm nearly
unbreakable.
• Standard public key = 1024 bits…that’s 309 digits!

RSA-1024:
13506641086599522334960321627880596993888147560
56670275244851438515265106048595338339402871505
71909441798207282164471551373680419703964191743
04649658927425623934102086438320211037295872576
23585096431105640735015081875106765946292055636
85529475213500852879416377328533906109750544334
999811150056977236890927563
Find More
• https://sites.google.com/site/danzcosmos/why-
rsa-encryption-is-secure

• https://intellipaat.com/blog/what-is-rsa-algorit
hm/

You might also like