I am using mbed TLS on siliconlab microcontroller. I am using Openssl on android for Ecdh implementation and mbed TLS for the microcontroller.
On Android, i am able to calculate Ecdh shared Secret using X and Y coordinates of the curve generated by mbed TLS.
But on mbed TLS I am not able to calculate Ecdh shared Secret using the X and Y coordinates sent from android.
I am concatenating the X and Y and pass the buffer to the following function:
mbedtls_ecdh_read_public(&ecdhContext, concatinatedArray, 58);
but it returns error code .
1- Is there any simple way i can use the X and Y coordinates to calculate the Ecdh shared secret?
2- Is there any example that works with openSsl Ecdh?
3- How i can generate/ calculate public key from the X and Y coordinates?
I used the following function to get the public key:
mbedtls_ecp_point_read_binary(&ecpGroup, &ecpPoint, concatinatedArray.dataPtr, (size_t)concatinatedArray.dataLength);
but it is not correct.
mbedtls_ecdh_compute_shared gives error MBEDTLS_ERR_ECP_INVALID_KEY
I will be really thankful for your kind help.