# Can Bob and Alice do an authenticated Diffie–Hellman key exchange if Bob only knows the hashsum of Alice's key?

Tor vanilla bridges look like this:

Bridge x.x.x.x:1234 9DD03662B50FEDBF6F8D5630CB86D7E8CE4F4432

It's only the IP/Port and a hash of the key.

Can Bob and Alice do an authenticated Diffie–Hellman key exchange if Bob just knows the hashsum of Alice's key?

Thinking by myself is possible, Bob receives Alice's key and verify the integrity, if a there is a different hash of the key, Bob end the connection and knows that a Man-in-the-middle attack happened; with the right key, Bob can encapsulate a block cipher secret key with Alice's key and send to the, she decrypt the data block and send her key to Bob encrypted with block cipher secret key that Bob send to her, and so an encrypted tunnel is established.

/\ am I right?

Correct, Bob can be sure there is no man-in-the-middle attack when initiating communication with Alice, as long as he has been reliably informed of the hash of Alice's public key and the hash is cryptographically secure. Alice, however, cannot know for sure she is talking to Bob, since Alice has no way of verifying Bob's public key.

Note that the protocol should be designed to include nonces that will prevent replay attacks.

• If Bob sends his public key to Alice together with an hashsum of Bob's key, will Alice have sure that it's Bob's key? As the connection is encrypted with private key of block cipher, she will get the encrypted Bob's public key. Apr 25, 2022 at 21:09
• @phantomcraft: if Alice gets a public key and a hash sum from somebody, how is she supposed to know that that somebody is Bob? Anyone could send a public key and a hash sum... Apr 25, 2022 at 21:11
• @poncho I understood you. Apr 25, 2022 at 21:19