2
$\begingroup$

I am working on a password manager application that saves the user's passwords in a remote server. I need to use AES in CTR mode to encrypt the passwords before sending them to the server. The client is supposed to login/identify himself with a master password (which is already set in the server). This is what I've thought of until now:

  1. Client connects to server.
  2. Server sends a random value RAND1.
  3. Client generates a random value RAND2, and calculates hmacKey = SHA1 (master|RAND1|RAND2).
  4. Client calculates HMAC of RAND2, appends it to RAND2 and sends it to the server.
  5. The server (who knows the master password) calculates its own hmacKey and verifies the client.

This hmac key would be used during this whole session. Is this secure?

$\endgroup$
3
  • $\begingroup$ No, since eavesdroppers can use ​ 3. & 4. ​ to check possible master passwords. ​ ​ ​ ​ $\endgroup$
    – user991
    Mar 25, 2016 at 21:45
  • $\begingroup$ anything speaking against TLS-SRP or TLS-PSK? $\endgroup$
    – SEJPM
    Mar 25, 2016 at 21:52
  • $\begingroup$ I actually need something that works similarly to EAP-SAKE described in RFC4763. What's missing? Would it work if I used PBKDF2 instead of SHA1? No I can't use TLS. $\endgroup$
    – dluga
    Mar 25, 2016 at 22:28

1 Answer 1

2
$\begingroup$

You have the classic problem of establishing a common secret key between the two parties before they begin exchanging any sensitive information. Consider Diffie-Hellman or - since you're dealing with a client/server setup and the risk of a MitM - a private key on the server side and then use public key encryption to establish the session key before communicating the password. This can be achieved with RSA, authenticated DH, ElGamal, and a few other methods.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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