Suppose I have a protocol like the one below between users A and B;

-A sends random nonce G1 to B

-B sends back hash_k(G1) and random none G2

-A verifies hash_k(G1), then sends back hash_k(G1 | G2)

-B verifies and a connection is made

Would this protocol be safe from eavesdroppers and other attacks like man in the midddle?

  • Is hash_k a keyed hash? In that case A and B must already have a secret key between them. What is the purpose of this protocol, identification or key exchange? – S.L. Barth - Reinstate Monica May 12 '15 at 11:08
  • The purpose of this protocol would be to establish a secure connection between the two users, with a secret k they have. – user124627 May 12 '15 at 11:38
  • 1
    So they already both have the secret value k? And the purpose is that A can verify that B knows k, and vice versa? – S.L. Barth - Reinstate Monica May 12 '15 at 11:43
  • 1
    Why don't you simply stick to a known implementation of TLS ? – Stephane May 12 '15 at 11:46
  • 1
    Schneier's law will come quickly into focus here. It's incredibly easy to do encryption/secure transport badly and incredibly hard to do encryption/secure transport well. Choose something well tested or become a statistic. To put it another way, you can through much hard work, come up with something that you can't hack, but is found open to the wide world when others analyze it. – Fiasco Labs May 13 '15 at 2:28

Your protocol is not safe by any means!

Example for MitM:

  • A sends random nonce G1 to B
  • C intercepts and sends nonce G1c to B
  • B sends back hash_k(G1c) and random nonce G2
  • C intercepts and sends hash_k(G1) and nonce G2c to A
  • A verifies hash_k(G1) (is OK), then sends back hash_k(G1 | G2c)
  • C intercepts and sends back hash_k(G1c | G2)
  • B verifies and a connection is made

So C can now intercept all traffic...

Also eavesdropping is possible with your protocol...

| improve this answer | |
  • I assumed hash_k to be a keyed hash. In that case C could not calculate hash_k(G1). – S.L. Barth - Reinstate Monica May 12 '15 at 11:07
  • 1
    @S.L.Barth and the key is exchanged how? – Uwe Plonus May 12 '15 at 11:13

No. Stick to known protocols such as TLS, Kerberos, SSH & IPSec for key exchanges.

Try researching Diffie-Hellman key exchanges and ECDH (Elliptical Curve Diffie-Hellman, the new method of key exchanges like your example).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.