# Why doesnt RSA use composite numbers?

I am currently writing a math paper regarding the importance of prime numbers in RSA encryption. I understand that generating q x p = N (where p and q are prime numbers) is simple for a computer however factoring N into its two primes is improbable within a reasonable amount of time.

As mentioned before I am addressing the importance of prime numbers. What I think the reason for their importance is that if RSA used composite numbers they can be broken up into smaller numbers as they are composite making it easier to factor however I am unsure if this is correct reasoning.

I would greatly appreciate it if someone could help me understand the true importance of prime numbers beyond the simple reasoning that it is because factoring N is highly improbable in a reasonable amount of time.

• Does this answer your question? RSA with modulus product of many primes It is called Multi-Prime RSA and even there is a standard for it. Note that original RSA modulus is already a composite number and it has a special name; semi-prime Dec 30 '21 at 15:55
• @kelalaka I have read through the thread you attached however I am still left confused as I was asking whether composite numbers are able to be used not multiple primes such as n = p x q x r (where p, q and r are primes) Dec 30 '21 at 16:07
• Arbitrary composite number will have many small factors. Look for this. Dec 30 '21 at 16:20
• Are you asking something like this; select a random number $N$, if prime discard it. Now can we use this as an RSA modulus? Sure 1) if you can factor the $N$ to find $\phi(N)$, if you can factor everybody can factor so no security 2) make sure that it is not a smooth number. Dec 30 '21 at 16:41
• @kelalaka no but thank you for answering my question. I was asking whether using non-prime numbers for p and q changes the effectiveness/ security of RSA encryption. I am not concerned with whether N is prime or not prime Dec 30 '21 at 18:18

In order to create a private, public key pair we need to know the factorization of N. If we pick N as a random composite number we are no better off then an attacker. If we can find the factors so can the attacker.

If we pick p and q as random numbers we will need to factorize them in order to find the factors of N, this may be easy or hard. But in the end we want N to be hard to factor. One thing we want is for N to have no small factors which will aid in factorizing it.

In order to ensure: a. The generator of the secret key knows the factors of N b. An attacker can not easily find any factor of N

We choose random large primes p,q and multiply them to produce N.

There are also multi-prime variants of RSA with more than 2 primes used to create N but we still start with large primes.

• I understand the multi-prime variant of RSA however I will not be addressing this in my paper due to the word count. However, I am still confused as my original question is not about choosing a random number which is N however if using composite numbers that combine to make N is still possible/ safe with regards to RSA encryption. I hope what I am saying makes sense I am still a newbie to encryption. Dec 30 '21 at 16:12
• If you choose p, and q to be composite you may end up with an easy to factor N. It will almost definetly include small factors. On the flip side, p and q may be hard to factor for the key generator. Dec 30 '21 at 16:30
• For clarity purposes, N is easier to factor as having non-prime numbers (composite numbers) makes the factoring easier as it can be broken up into smaller numbers (not possible with primes as it is only itself and 1) decreasing computation time? Additionally, does using prime numbers decrease computation time to generate both the private and public keys? Dec 30 '21 at 18:22
• In order to generate key pair you must know the factorization of N. If you chose p,q prime you already know it. If they are composite you must first factorize them which could be very hard. Dec 30 '21 at 20:14