Libgcrypt: How to implement ECIES encryption (ECC + AES)

Yann Garcia garcia.yann at
Mon Nov 12 13:24:01 CET 2018

Dear All,

I want to implement ECIES encryption. To do it, I have to 1) generate ECDH
secret key (the key agreement) and then 2) derive it using Key Derivation
Function 2 (KDF2).

1) For the key agreement, I need to generate a random number. Can you
indicate me the best way to generate this random number because in the
help, clause 9.2 Retrieving random numbers, I found 3 different methods and
I don't know which one is the best for my purpose?

2) Is it correct to use the function gcry_kdf_derive() with GCRY_KDF_PBKDF2
flag to do the Key Derivation Function 2?

3) Does the libgcrypt provides samples for ECIES encryption?

Many thanks in advance for your help,

Best regards,
Yann Garcia
Senior Software Engineer
Microsoft Certified
Le Montespan B2
Avenue des Alpes
F-06600 Antibes, FRANCE
Tel: +33 (0)4 92 94 49 08
Mobile: +33 (0)7 61 00 77 05
Email: *yann.garcia at* <yann.garcia at>
           Yann.Garcia_EXT at
Skype: yann.garcia
Google+: garcia.yann at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Gcrypt-devel mailing list