# Public Keys on Social Media

Is there any problem with using social media (i.e. Facebook) as a directory of public keys?

For example, couldn't Alice put a note containing $(g^a \bmod p, g, p)$ on her Facebook page so she could receive email attachments which have been encrypted with the common secret value?

That is, Bob would encrypt his message with the value obtained from $(g^a)^b \bmod p$ and send it along with in-the-clear $g^b \bmod p$ to Alice. She then can decrypt the message.

If everyone were to publish their public keys, wouldn't this defeat most "man-in-the-middle" attacks?

-
What's to stop a hacker from putting his public key in Alice's profile? –  pg1989 Aug 12 '13 at 21:37
You are effectively using FB as a keyserver. This question on Security.SE might be of interest. –  rath Aug 13 '13 at 14:46

• If your own computer/browser is compromised, the attacker will either know the according secret $a$ anyway or he can modify your profile update to a value of his choice.