Question: how public key encryption works?
Answer: Public key cryptography allows someone to send their public key in an open, insecure channel. Having a friend's public key allows you to encrypt messages to them. Your private key is used to decrypt messages encrypted to you.