RSA encryption. Breaking 2048 keys with index I have some thoughts on this. First, I want to say I am no expert on cryptography, I just know some stuff, and I took a cryptography class in University. I am very interested in this topic.
I understand that many security experts out there might get angry just by the discussion of these things, but I hope you can spare me :)
My Questions:
Would it be possible to break an RSA key, in for example 1 week of time, if the cracker have already spent X number of years building an index of primes by performing every permutation of existing prime keys up to 2^2048 ?
I understand this would take an immense amount of time to do, but it would only be done once.
Given the public key, you would be able to look up what the two primes are, and hence retrieve the private key instantly.
When I consider who might break such a code, I am primarily thinking about NSA and other Governments that might have spent years in research and have the resources and interest in doing so.
Breaking an 256 AES would then be easier, as AES keys are often generated using the RSA private key.
Would it be possible to build such an index ? How long would that take in permutations, and perhaps with the fastest computer in the world ?
I hope we can have a nice chat about this. We are just discussion theory here. I hope you can offer me some insight on this topic.
Thanks!
 A: A 2048-bit key consists of two 1024-bit primes, of which there are $\pi(2^{1024})-\pi(2^{1023})\approx1.26691\cdot10^{305}$ (all digits shown are exact, the next digit is between 5 and 8).
Storing all these primes would take $1.26691\cdot10^{305}\cdot1024\approx1.29732\cdot10^{308}$ bits—well, or just $1.29479\cdot10^{308}$ bits if you store the first and last bits implicitly.
The Bekenstein bound for the observable universe (mass $2.5\cdot10^{54}$ kg including dark matter/energy, comoving distance $4.4\cdot10^{26}$ m) is approximately $2.8\cdot10^{124}$ bits. It's not possible to store more information: there's no more matter to store it, and matter further away can't reach our Minkowski cone.
So at best we can store
$$
\frac{2.8\cdot10^{124}}{1.29479\cdot10^{308}}\approx2.2\cdot10^{-182}\%
$$
of those primes.
But never fear! Perhaps you don't need a database of all the primes, you can make do with just some of the primes. So set up the observable universe (minus a small chunk, say the Earth) as your dictionary of primes, then suppose everyone on Earth picks a trillion trillion 2048-bit RSA keys. This is a total of $7.05\cdot10^9\cdot10^{12}\cdot10^{12}\cdot2=1.41\cdot10^{34}$ primes. Your dictionary contains at least one of the primes with probability $\approx1.41\cdot10^{34}\cdot2.2\cdot10^{-184}\approx3.1\cdot10^{-150}$.
A: The prime numbers used in RSA keys are randomly generated, freshly for every new RSA key. If an RSA key pair is generated properly, then each of its two prime numbers will be unique -- never before generated in the history of humankind (with a probability that is close enough to $1$ to make no difference). This is because there are more than $2.5 \times 10^{305}$ primes less than $2^{1024}$. Which kind of spoils your idea of building a table...
