It is also possible to use Diffie–Hellman as part of a public key infrastructure. Alice's public key is simply (ga,g,p). To send her a message Bob chooses a random b, and then sends Alice gb (un-encrypted) together with the message encrypted with symmetric key (ga)b. Only Alice can decrypt the message because only she has a. A preshared public key also prevents man-in-the-middle attacks.
In practice, Diffie–Hellman is not used in this way, with RSA being the dominant public key algorithm. This is largely for historical and commercial reasons, namely that RSA created a Certificate Authority that became Verisign. Diffie–Hellman cannot be used to sign certificates, although the ElGamal and DSA signature algorithms are related to it. However, it is related to MQV, STS and the IKE component of the IPsec protocol suite for securing Internet Protocol communications.