I am trying to implement the RSA cryptography algorithm using C language. I am not sure of the size that each operand should have. Let me explain:
RSA requires to generate two huge prime numbers p and q, and compute their product n = pq. Let's suppose that we want to use a key size = 2048 bits.
So we generate two 2048-bits prime numbers. Hence their product is 4096 bits-wide. But as we said, our key size is 2048 bits ! So should we use only the low-part of this product i.e the 2048 less significant bits of n ?
Or should we limit the range of p and q to 1024 bits i.e half of the key size ?
I don't know what is the impact of these two options on the safety of the system.