3

I don't understand how an algorithm is able to encrypt plaintext with a public key yet not be able to decrypt it with the same key. Could someone explain this process in the simplest form possible, with mathematical terms defined?

liamzebedee
  • 14,010
  • 21
  • 72
  • 118
  • [The RSA](http://en.wikipedia.org/wiki/RSA) wikipedia articles have information that you need – momo Sep 11 '11 at 12:15
  • Your instincts are good, it is indeed startling. If you really want to understand you will have to try some examples for yourself. – President James K. Polk Sep 11 '11 at 13:32
  • See [How does asymmetric encryption work?](http://crypto.stackexchange.com/questions/292/how-does-asymmetric-encryption-work) on our sister site about cryptography. – Paŭlo Ebermann Sep 11 '11 at 15:19

3 Answers3

4

At the very heart of asymmetric keys there is always some mathematical identity which is computationally intractable. The classic example would be the RSA algorithm. Its mathematical foundation is that there are numbers b, m, n such that (b^m)^n = b (in modular arithmetic). That is, if b is my message, and if m and n are the two parts of an asymmetric key, then one key can decipher something that the other key encrypted. That is, b^m, and also b^n, serve as cipher texts which can be deciphered by raising them to the respective other power. The reason that those are secure ciphers is that it is computationally infeasible to obtain b from b^m (even if you know the value m*n, which needs to be public, too). Thus the pairs (m, mn) and (n, mn) constitute an asymmetric key pair.

As another example of not knowing a private secret but still sharing another secret between two parties, consider Diffie-Hellman key exchange: Here Alice and Bob keep a secret number x and y, respectively, that nobody else knows. Then Alice tells Bob c^x, and Bob tells Alice c^y, for some public value c. Now both sides can compute the value c^xy, but neither side knows the other party's secret, nor does any eavesdropper know the value of c^xy. Here the mathematical foundation is that it is computationally infeasible to obtain x from c^x, even if you now c.

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
4

Think of it like this. Some mathematical operations are invertible. Consider, for example, the operation "multiplication by a non-zero real number." Fix a non-real number s and consider the operation f(x) defined by x -> x * s. Then this operation is invertible. In fact, if you take t = 1 / s then the operation g(x) defined by g(x) = x * t has the property that g(f(x)) = x so that f is invertible. Think of x as the message, s as the public key, f as the encryption algorithm, t as the private key and g as the decryption algorithm. Of course, this is a terrible algorithm, but this is all there is to asymmetric encryption: find a parameterized invertible mathematical operation. The parameter provides the public key, and the "inverse parameter" provides the private key.

Of course, with encryption we want it to be harder to find the inverse. In fact, the mathematics of RSA, the most well-known of the asymmetric key algorithms, are quite sophisticated. It relies on the fact that a certain mathematical problem is thought to be extremely hard.

jason
  • 236,483
  • 35
  • 423
  • 525
2

You can find a fairly good explanation of public key cryptography here. That doesn't go into much detail about the math involved, since it is quite complex and impossible to explain in simple terms. You might also want to take a look at the answers to this related question:

Community
  • 1
  • 1
EdoDodo
  • 8,220
  • 3
  • 24
  • 30