12

I've learned the theory of public key encryption but I'm missing the connection to the physical world. e.g.

I've been told that good RSA encryption should rely on prime numbers with 300 decimal digits but why? who came up with this number? How long it will take to break such encryption (statistics about different machines).

I've tried Google, but couldn't find what I wanted. anyone?

thanks

Yehonatan Ginzberg
  • 131
  • 1
  • 1
  • 6
  • 1
    Please focus questions. Hopefully the title change will prevent this from being mercilessly downvoted and closed .. –  Aug 06 '12 at 16:17

3 Answers3

13

The key of asymmetric cryptography is to have an asymmetric function which allow decrypting message encrypted by the asymmetric key, without allowing to find the other key. In RSA, the function used is based on factorization of prime numbers however it is not the only option (Elliptic curve is another one for example).

So, basically you need two prime numbers for generating a RSA key pair. If you are able to factorize the public key and find these prime numbers, you will then be able to find the private key. The whole security of RSA is based on the fact that it is not easy to factorize large composite numbers, that's why the length of the key highly change the robustness of the RSA algorithm.

There are competitions to factorize large prime numbers with calculators each years with nice price. The last step of factorizing RSA key was done in 2009 by factorizing 768 bits keys. That's why at least 2048 bit keys should be used now.

As usual, Wikipedia is a good reference on RSA.

Nibbler
  • 503
  • 5
  • 10
  • 2
    The security of RSA is based on the difficulty of factoring large *composite* numbers that are the product of two primes of roughly the same size. – President James K. Polk Aug 06 '12 at 22:37
  • not really ... the security of RSA is based on the fact that you can't efficiently calculate a modular inverse ... in this case you need PHI(n) for that calculation while you only have n with n=p*q with p and q unknown ... if you find another way to calculate PHI(n) ... other than (p-1)*(q-1) ... you would have broken RSA without factorizing n ... but that task is considered at least as difficult as factorizing n – DarkSquirrel42 Aug 06 '12 at 23:23
  • I am a bit late to the party, but this answer really coalesced my understanding of RSA. – Kamuela Franco Sep 11 '15 at 16:54
10

All public key algorithms are based on trapdoor functions, that is, mathematical constructs that are "easy" to compute in one way, but "hard" to reverse unless you have also some additional information (used as private key) at which point also the reverse becomes "easy".

"Easy" and "hard" are just qualitative adjectives that are always more formally defined in terms of computational complexity. "Hard" very often refers to computations that cannot be solved in polynomial time O(nx) for some fixed x and where n is the input data.

In the case of RSA, the "easy" function is the modular exponentiation C = Me mod N where the factors of N are kept secret. The "hard" problem is to find the e-th root of C (that is, M). Of course, "hard" does not mean that it is always hard, but (intuitively) that increasing the size of N by a certain factor increases the complexity by a much larger factor.

The sizes of the modulus which are recommended (2048 bits, or 617 decimal digits) relate to the availability of computation power at present time, so that if you stick to them you are assured that it will be extremely expensive for the attacker to break it. For more details, I should refer you to a brilliant answer on cryptography.SE (go and upvote :-)).

Finally, in order to have a trapdoor, N is built so as to be a composite number. It theory, for improved performance, N may have more than 2 factors, but the general security rule is that all factors must be balanced and have roughly the same size. That means that if you have K factors, and N is B bits long, each factor is roughly B/K bits longs.

This problem to solve is not the same as the integer factorization problem though. The two are related in that if you manage to factor N you can compute the private key by re-doing what the party that generated the key did. Typically, the exponent e being used is very small (3); it cannot be excluded that someday somebody devises an algorithm to compute the e-th without factoring N.

EDIT: Corrected the number of decimal digits for the modulus of a 2048 bits RSA key.

Community
  • 1
  • 1
-2

RSA uses the idea of one-way math functions, so that it's easy to encrypt and decrypt if you have the key, but hard (as in it takes lots and lots of CPU cycles) to decrypt if you don't have the key. Even before they thought of using prime numbers, mathematicians identified the need for a one-way function.

The first method they hit upon was the idea that if your "key" is a prime number, and your message is another number, then you can encrypt by multiplying the two together. Someone with the key can easily divide out the prime number and get the message, but for someone without the prime number, figuring out the prime number key is hard.

Yusuf X
  • 14,513
  • 5
  • 35
  • 47