How to use nist_generate_key

Werner Koch wk at
Wed Nov 14 18:49:48 CET 2018

On Tue, 13 Nov 2018 09:16, garcia.yann at said:

> I'm looking for sample indicating of to use the function
> nist_generate_key()  using ECDH?

That is an internal function of libgcrypt and you can't use it from your
application.  You need to use Libgcrypt's API to do that.  Check the
manual for the gcry_pk_genkey function.  To create an ECC keypair for
the NIST P-521 curve, you need to use these parameters

      "(genkey(ecc(curve nistp521)(flags nocomp)))"

convert them to an s-expression object and pass it to gcry_pk_genkey.
There are several examples for it in libgcrypt's soruce code (under
tests/) and you can also look into GnuPG (agent/genkey.c:agent_genkey is
the core which is called from g10/keygen.c:gen_ecc).



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <>

More information about the Gcrypt-devel mailing list