This question already has an answer here:

Let's say we have Alice and Bob in a chatroom, trying to communicate. They're connected to the same network, but we have the network admin constantly monitoring all data being sent to servers (and received from servers, for that matter). How would they be able to send messages to each other without the Administrator being able to see? Assuming they're sending plaintext messages, nothing complicated

marked as duplicate by Arminius, Community Dec 30 '17 at 21:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • (I'm voting to close this question as a duplicate because Diffie-Hellman is one possible answer on how to exchange keys over a public channel which seems to solve what you're asking for.) – Arminius Dec 30 '17 at 20:29
  • The answer is to encrypt the communication. But I think you knew that. What's your real question? – schroeder Dec 30 '17 at 20:42
  • 1
    The admin will see the messages, but will not be able to read them. Which goal are you looking for? Hiding, or making it unreadable? – schroeder Dec 30 '17 at 20:43

You might be interested in PGP communication: http://www.pitt.edu/~poole/PGP.htm

Both of you would generate a public key-private key pair on your local systems. Each key pair is mathematically related, that is, a public key is related to its private key. You would then publish the public key, well, publicly for everyone to see. The idea is anyone can encrypt a simple plaintext message using your public key and send you the result. Only you would be able to decrypt the message using your stored private key.

So in this case, Alice would tell Bob their public key, in the chatroom or somewhere else. Bob then uses Alice's public key to encrypt a secret plaintext message, then posts the result on the chat service. Alice grabs the encrypted message from the chat server and decrypts it at their local machine using the secret private key. Similarly, communications from Alice to Bob are also encrypted using Bob's public key.

The steps involved in generating a public key-private key pair are listed here: http://www.seas.upenn.edu/cets/answers/pgp_keys.html

Not the answer you're looking for? Browse other questions tagged or ask your own question.