I want to establish a secure Bluetooth connection from the client side with a nordic chip (nRF52). I also have the wolfSSL library running. So I receive a 'BLE_GAP_EVT_LESC_DHKEY_REQUEST' request from the nordic softdevice with the peer-64byte key. Now I need to generate my own key pair and send the public key back to the central. How can I manage this? Am I right that the following functions is not the correct one for the BTLE secure connection?
wc_InitDhKey(...);
wc_DhGenerateKeyPair(...);
...
sd_ble_gap_lesc_dhkey_reply(...);
I need to generate a elliptic curve Diffie-Hellman key-pair with a P-256 length. Unfortunately I am not an expert in this topic. Which functions do I need to call from the wolfSSL library to generate such a public ECDH-key?
Thanks for your answer or hints
I suggest you too look at the documentation of the module curve25519 to generate an elliptic key:
https://www.wolfssl.com/wolfSSL/Docs-wolfssl-manual-18-10-wolfcrypt-api-curve25519.html