I'm not keen on encryption and security overall, so please forgive my ignorance. Let's assume the following:

We have two nodes which are constrained devices (resources not sufficient for asymmetric encryption), and we want to securely establish a shared key for symmetric encryption.

My solution is the following: save a key K(0) in the devices at deployment program the devices to automatically generate a new key of a new session based on:

  1. the previous key
  2. a random number generation function installed in the two devices, with the same epoch

So a session k(i+1) is generated based on the information of the session k(i) that the only two participants have.

Please, now tell me what are weaknesses of this solution.

Thank's in advance.


This approach works, if you derive the session key in a secure manner (using a cryptographic hash function or some construction built on a cryptographic hash function).

As only the two parties know the key, only the two parties will know subsequent keys.
It may even be possible to omit the the synced random number generator and just use some session constant as derivation parameter for your key derivation function (KDF).

Another approach:

But there's a way to do this without a synced Random Number Generator (RNG) and fresh keys for all connections. This assumes you've got a good random number generator and the pre-shared key K of length 64 bytes which is highly random. All undefined variables below are random and 32 bytes long.

  1. Device A sends device B a random number n_A.
  2. Device B responds with E_K(r_B,n_A,n_B). If the answer takes too long A refuses the answer or if the n_A is not the n_A sent in step 1.
  3. Device A responds with E_K(r_A,n_B,n_A). If the answer takes too long B refuses the answer or if the n_B is not the n_B sent in step 2.

Now you can use the xor of r_A and r_B and use a KDF to get the session key, if you're not sure about your RNG you can also input K into the KDF call. Note that you may wish to use GCM mode for your cipher.

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.