Let's consider that Alice and Bob both know a shared secret $secret$ and don't know each other DH public keys. They want to authenticate each other and their keys using only $secret$. Let's also forget about an existence of SMP. Can the following scheme be considered secure?
First, Alice and Bob perform Diffie-Hellman KE:
$Alice: send(g^a)$
$Bob: recv(g^a);\ send(g^b)$
$Alice: recv(g^b)$ // Now both Alice and Bob has a shared $dh\_key$
Next, they want to be sure that their companion:
a) Knows a shared secret.
b) Is the owner of the corresponding DH private key.
$Alice: send(HMAC(g^a, secret))$
$Bob: recv\_and\_check(msg, secret); send(HMAC(g^b, secret))$
$Alice: recv\_and\_check(msg, secret)$
If all checks are passed Alice and Bob can start a secure data exchange. They also can save DH-public keys for future conversations.
So:
- Is the scheme secure?
- If the answer to the first question is 'yes' what are pros and cons in comparison with SMP (like in OTR SMP)?