Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Attacks on RSA
Brute Force Attack
Timing Attack
Computing φ(n)
Frequently Asked Questions
What is Cryptography?
What are types of Cryptography?
What is RSA?
What does RSA stand for?
What is the Rabin Cryptosystem?
Last Updated: Mar 27, 2024

What are the Attacks on RSA?

Author Rajat Agrawal
0 upvote
Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @


In today's world, everyone is dependent on the Internet, which is an insecure channel to send a piece of information. We are using applications such as Whatsapp, Facebook, Instagram, Snapchat, etc. All these applications don't have any meaning without the internet. We use these applications to send and receive information, and these applications promise us to keep secure our information/data. These applications use Cryptographic Systems like RSA to secure the insecure channel (i.e., Internet). 


In this blog, we will discuss different attacks on RSA Cryptosystem.

Attacks on RSA

Some of the possible attacks on RSA are:-

  • Brute force attack
  • Timing attacks
  • Computing phi(n)

Let’s discuss these attacks one by one.

Brute Force Attack

brute force attack

Let’s understand the brute force attack in simple steps:

  • Finding the two prime numbers, p and q, that were multiplied to get the modulus n is the first step in decrypting the private key.
  • Factoring n is equivalent to calculating φ(n) for a given n.
  • With the currently available algorithms, factoring the problem takes at least as long as figuring out d given e and n.
  • Since factoring N allows us to brute-forcibly crack a private key, RSA's security depends on how challenging it is to factor huge numbers.

Since the algorithm can be attacked by brute force, the RSA designers have put some constraints on p and q.

Also read - active and passive attacks

Timing Attack

Timing Attack

Let’s understand the timing attack in simple steps.

  • A timing attack is similar to a thief figuring out a safe's combination by watching how long it takes someone to flip the dial from one number to the next.
  • It has been found that the value of the key influences how long the RSA algorithm needs to complete its cryptographic operations.
  • Therefore, a rough estimate of the private key can be generated based on the time needed to apply it to certain information.
  • Depending on how close an attacker may approach the process of carrying out the crypto operation, the significance of this danger grows.
  • If the attacker cannot watch the processing time closely, the attack is not practical.
  • Rivest has proposed a solution that normalizes computation time so that different keys have comparable execution limits.

Computing φ(n)

We know that computing φ(n) is no easier than factoring n. 

If we know n and φ(n), and n is the product of two primes p and q, then n can be easily factored by solving the two equations:-

                    n = p*q                                      (Eqn 1)

φ(n) = (p − 1)(q − 1)                                      (Eqn 2)

For the two “unknowns,” p and q. The following steps make it simple to do this. When we put q = n/p into the second equation, we get a quadratic equation with the number p being unknown:-

p2 - (n- φ(n)+1)p +n = 0.

The two roots of the above equation will be p and q, the factors of n. Therefore, a cryptanalyst can factor n and undermine the system if he discovers the value of φ(n). In other words, computing φ(n)  is not any simpler than factoring n.

You can read about the difference between Active Attack and Passive Attack in detail here.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Frequently Asked Questions

What is Cryptography?

Cryptography is the technique to secure sensitive data/information passing through an unsecured channel.

What are types of Cryptography?

There are mainly two types of Cryptography Symmetric Key Cryptography and Asymmetric Key Cryptography.

What is RSA?

RSA is the Asymmetric Key Cryptographic algorithm used for the Encryption and Decryption of sensitive data.

What does RSA stand for?

RSA stands for Rivest, Shamir, and Adelman.

What is the Rabin Cryptosystem?

The Rabin cryptosystem is an asymmetric cryptographic method invented by Michael Rabin. The difficulty of factorization is related to the security of the Rabin cryptosystem. It has the advantage over the others in that the problem it banks on has proven to be difficult as integer factorization.


In this article, we have extensively discussed different attacks on RSA Cryptosystem. I hope you enjoyed this blog on What are the attacks on RSA? 
If you want to learn more, check out our articles on What is the Rabin Cryptosystem?Message Authentication Codes in CryptographyNested MACs and HMAC in Cryptography, and CBC-MAC in Cryptography
Also, check out these exciting courses from coding ninjas to expand your knowledge, Coding CourseCode StudioInterview ExperienceGuided PathInterview ProblemsTest SeriesLibrary, and Resources

Happy Coding!

Previous article
What are the Factoring Algorithms in Practice?
Next article
Wiener’s Low Decryption Exponent Attack on RSA
Live masterclass