0

Wouldn't anyone else be able to decrypt it too using the public key? Or is it saying that it will be decrypted with a private key. If that's the case how could something be encrypted with one key and decrypted with another?

This is in reference to this wikipedia article.

Specifically - "In order to generate the session keys used for the secure connection, the client encrypts a random number with the server's public key and sends the result to the server. Only the server should be able to decrypt it, with its private key."

Sorry if this was a silly question.

Chris W
  • 785
  • 8
  • 18
  • possible duplicate of [Various questions about RSA encryption](http://stackoverflow.com/questions/20111827/various-questions-about-rsa-encryption) – Artjom B. Jun 22 '15 at 22:54
  • 1
    It's not a silly question. It's simply too broad. Analogy: Why do you have to push/rotate the door handle to open the door, but don't need to do anything with the handle to close the door? It's just how the mechanism works. Take some example numbers and calculate it through. – Artjom B. Jun 22 '15 at 22:57

1 Answers1

0

Because it's public-private key encryption, not symmetric encryption. The plaintext is encrypted to cipher text with the public key and decrypted back to the plaintext with the private key. Trying to decrypt that ciphertext with the public key doesn't work.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Thank that helps. I'm still perplexed by how two different keys can be used though. – Chris W Jun 23 '15 at 00:27
  • If this is RSA, then the public and private exponents, and the modulus, are just integers. The message is an integer. Raise the message to the power of the public exponent, divide by the modulus, take the remainder, raise to the power of the private exponent, divide by the modulus, take the remainder, and the math gives you the original message. It's all in the math. Google, "How RSA works". – Jim Flood Jun 23 '15 at 03:37