1 (edited by kjjy7 2018-08-06 23:26:07)

Topic: How to ECDH using wolfssl API ? ( encryption & decryption.)

I don't know how to make ECDH using wolfssl api.

especially, encryption and decryption.

give me answer, plz.

Is there any ECDH examples using wolfssl api

regards

Share

Re: How to ECDH using wolfssl API ? ( encryption & decryption.)

Hi kjjy7,

You would use the function:

wc_ecc_shared_secret
Parameter 1: your static private key
Parameter 2: Public key from the end entity used to generate the shared secret when combined with your private key
Parameter 3: an output buffer to store the shared secret
Parameter 4: the size of the output buffer when passed in, gets updated by calling function to indicate size of shared secret.

Example:

unsigned char* sharedOutBuf[512]; // size assumes a 256-bit curve field, adjust if using large curve field to (curve_fieldSz*2)
word32 sOutBSz = 512;


ret = wc_ecc_shared_secret(&userA_priv, &userB_pub, sharedOutBuf, &sOutBSz);

Regards,

Kaleb

Re: How to ECDH using wolfssl API ? ( encryption & decryption.)

I know this is an old thread, but follow up question:

Once the shared secret is created, how do you encrypt/decrypt with the wolfssl api?

Share

Re: How to ECDH using wolfssl API ? ( encryption & decryption.)

Please checkout:

wc_ecc_encrypt(): https://www.wolfssl.com/doxygen/group__ … a32b9795b2
wc_ecc_decrypt(): https://www.wolfssl.com/doxygen/group__ … 804aca27e6


- KH