Dear community,

My target is to establish a shared secret key between the PC application (master) and (various, different, but always limited to 1 at a time) peripheral devices.

Each device has:

PC application has:

Aim is to establish AES shared secret, by doing:

What is the correct way in mbedTLS, to get a public key from X509, that can be used in the ECDH module?

The way the ECDH module inside mbedTLS seems to be designed, there is no straight-forward way to export X5090’s public key, get its parameters and use them in ECDH module.

Instead, ECDH expects that random keypair will be generated every-time we want key exchange. Doing this, we risk man in the middle attack, since the other party doesn’t know where the key is actually coming from.

For the moment, the solution I see (which is not THAT elegant, or is it?), and to avoid man in the middle attack::

Is this the proposed solution in this case? Is there a more elegant solution with the mbedTLS library for this problem?

Thanks

--
Tilen Majerle, mag.inž.el.
Tušev Dol 11
8340 Črnomelj
Slovenia
Mobile: +386 40 167 724

Virus-free.www.avast.com