Search code examples
encryptioncryptographyrsa

how client sending client's public key to server?


as of my research on google, i got that rsa works on this way.

  1. A client (for example browser) sends its public key to the server and requests for some data.
  2. The server encrypts the data using client’s public key and sends the encrypted data.
  3. Client receives this data and decrypts it

my question is, since we are communicating over https, everything should be encrypted. but how browser sending client's public key?

is it encrypted? cause server never shared servers public key to client (in order to encrypt public key of client)

how the 1st step happeningn-> (1. A client (for example browser) sends its public key to the server and requests for some data.)

thank you in advance.


Solution

  • Since the public keys are public, we don't need to encrypt it. it is okay to send public key in plain text. even a third party get your public key, they cannot decrypt the data which is encrypted with public key by the server.