Generating ECC shared-secret

Tyler Jowers jowerstc at gmail.com
Thu Sep 12 20:18:25 CEST 2019


Good Thursday,

I'm stuck figuring out how an ECC shared-secret should be generated
with Libgcrypt.

So far as I'm aware, the goal, after generating a public key with a
random number, is to replace the generator point G with the other
party's public key and use the local private key again to generate the
shared secret.

So I get the other party's q-point, then I (by some mechanism) convert
the q-point to an mpi-point? I tried gcry_sexp_build(.. "(genkey (ecc
(curve "NIST P-192") (g %S) (d %M)))",
gcry_sexp_cdr(gcry_sexp_find_token(other_party_keydata, "q", 1)),
u8_ptr_localprivatekey_as_mpi); And a few variations of that, and I
don't get any error, but I get a duplicate public-key returned that
matches verbatim the private-key.

I need to know how the API wants me to generate a shared secret. If
the way I was doing it is the right direction, how do I properly
convert the q-point into a valid g-point?

Regards,

Tyler Jowers



More information about the Gnupg-devel mailing list