I want to create some software that performs diffie hellman group key agreement but I don't want to reinvent the wheel even if I know how it's done. So I came accross the NaCl library, especially the scalar_mult functions.

As far I know you can perform Diffie Hellman key agreement on elliptic curves therefore, my thought is if I combine it with crypto_box ones for key generation, I can do a Diffie Hellman Key agreement.

My Idea is (described in some sort of pseudocode) shown in the following image:

Scalar multiplication DH example

Would you recommend it as shown above?

  • 1
    $\begingroup$ Well, the function specifies that it can be used for the (Computational) Diffie-Hellman problem, which is the underlying problem that allows DH key agreement calculations. So I presume it is yes. I'm however not a NaCl expert so I'll allow somebody else to answer (I think the function is mainly used in NaCl for ECIES, which would make for an easy answer, but I'm not 100% sure about that particular bit). $\endgroup$ – Maarten Bodewes Nov 12 '18 at 15:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.