We’re rewarding the question askers & reputations are being recalculated! Read more.
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
2 added 124 characters in body
source | link

I have the following setup:
A server and a client will be connected over tcp. The server and client both have access to the preshared secret key. When the client connects to the server, the client and server both need to know the key, so they need to use the same key to authenticate or it will fail.

I came up with the following process and would like to know if there is anything obviously wrong with it that I didn't see. The actual encryption is not relevant in this case. So this is what happens when the client connects:

  1. Server generates a 16 byte salt (salt1).
  2. Server calculates hashServer1 = HASH(key + HASH(key + salt1)).
  3. Server sends salt1 to client.
  4. Clients calculates using the received salt1 hashClient1 = HASH(key + HASH(key + salt1)).
  5. Client generates 16 byte salt (salt2).
  6. Client calculates hashClient2 = HASH(key + HASH(key + salt2)).
  7. Client sends (hashClient1 + salt2) to server.
  8. Server checks if received hashClient1 == hashServer1 and if not breaks.
  9. Server calculates using received salt2 hashServer2 = HASH(key + HASH(key + salt2)).
  10. Server sends hashServer2 to client.
  11. Client checks if received hashServer2 == hashClient2 and if not breaks.

If I am not mistaken, this should be pretty secure when using a strong hash algorithm. The key is never send as clear text and due to the salt the data is different every time.

EDIT: Changed the salt used for hashing from saltX to HASH(key + saltX).

I have the following setup:
A server and a client will be connected over tcp. The server and client both have access to the preshared secret key. When the client connects to the server, the client and server both need to know the key, so they need to use the same key to authenticate or it will fail.

I came up with the following process and would like to know if there is anything obviously wrong with it that I didn't see. The actual encryption is not relevant in this case. So this is what happens when the client connects:

  1. Server generates a 16 byte salt (salt1).
  2. Server calculates hashServer1 = HASH(key + salt1).
  3. Server sends salt1 to client.
  4. Clients calculates using the received salt1 hashClient1 = HASH(key + salt1).
  5. Client generates 16 byte salt (salt2).
  6. Client calculates hashClient2 = HASH(key + salt2).
  7. Client sends (hashClient1 + salt2) to server.
  8. Server checks if received hashClient1 == hashServer1 and if not breaks.
  9. Server calculates using received salt2 hashServer2 = HASH(key + salt2).
  10. Server sends hashServer2 to client.
  11. Client checks if received hashServer2 == hashClient2 and if not breaks.

If I am not mistaken, this should be pretty secure when using a strong hash algorithm. The key is never send as clear text and due to the salt the data is different every time.

I have the following setup:
A server and a client will be connected over tcp. The server and client both have access to the preshared secret key. When the client connects to the server, the client and server both need to know the key, so they need to use the same key to authenticate or it will fail.

I came up with the following process and would like to know if there is anything obviously wrong with it that I didn't see. The actual encryption is not relevant in this case. So this is what happens when the client connects:

  1. Server generates a 16 byte salt (salt1).
  2. Server calculates hashServer1 = HASH(key + HASH(key + salt1)).
  3. Server sends salt1 to client.
  4. Clients calculates using the received salt1 hashClient1 = HASH(key + HASH(key + salt1)).
  5. Client generates 16 byte salt (salt2).
  6. Client calculates hashClient2 = HASH(key + HASH(key + salt2)).
  7. Client sends (hashClient1 + salt2) to server.
  8. Server checks if received hashClient1 == hashServer1 and if not breaks.
  9. Server calculates using received salt2 hashServer2 = HASH(key + HASH(key + salt2)).
  10. Server sends hashServer2 to client.
  11. Client checks if received hashServer2 == hashClient2 and if not breaks.

If I am not mistaken, this should be pretty secure when using a strong hash algorithm. The key is never send as clear text and due to the salt the data is different every time.

EDIT: Changed the salt used for hashing from saltX to HASH(key + saltX).

1
source | link

Secure preshared key 2 way authentication

I have the following setup:
A server and a client will be connected over tcp. The server and client both have access to the preshared secret key. When the client connects to the server, the client and server both need to know the key, so they need to use the same key to authenticate or it will fail.

I came up with the following process and would like to know if there is anything obviously wrong with it that I didn't see. The actual encryption is not relevant in this case. So this is what happens when the client connects:

  1. Server generates a 16 byte salt (salt1).
  2. Server calculates hashServer1 = HASH(key + salt1).
  3. Server sends salt1 to client.
  4. Clients calculates using the received salt1 hashClient1 = HASH(key + salt1).
  5. Client generates 16 byte salt (salt2).
  6. Client calculates hashClient2 = HASH(key + salt2).
  7. Client sends (hashClient1 + salt2) to server.
  8. Server checks if received hashClient1 == hashServer1 and if not breaks.
  9. Server calculates using received salt2 hashServer2 = HASH(key + salt2).
  10. Server sends hashServer2 to client.
  11. Client checks if received hashServer2 == hashClient2 and if not breaks.

If I am not mistaken, this should be pretty secure when using a strong hash algorithm. The key is never send as clear text and due to the salt the data is different every time.