Hi,
Are you interested in using Diffie-Hellman standalone, or in the context of SSL/TLS? If using DH in SSL/TLS, the TLS protocol takes care of transporting the DH parameters and public keys.
If using DH in a standalone use case, your application will need a way to transfer the DH parameters and public keys to the other party. Using the dh_test() function in test.c as an example, both the client and server will load the DH parameters into a DhKey structure using one of the two functions:
wc_DhSetKey() - used with individual "p" and "g" parameters
wc_DhKeyDecode() - used with a DH "key" that contains the "p" and "g" parameters
Each side (client and server) will generate their own private and public keys using:
The public keys from the wc_DhGenerateKeyPair() operations will need to be transferred to the other peer. The final shared secret will then be derived by each side using:
Best Regards,
Chris