Generate ECDH shared key - NIST P256

mandar.apte409 at gmail.com mandar.apte409 at gmail.com
Mon Jun 22 14:44:31 CEST 2020


Hi all, 
   I am trying to generate ECC shared secret key using Libgcrypt 1.8.5. Based on documentation of Libgcrypt, I used gcry_pk_genkey() to generate public-private key pair on server and client. The S-Expression I used is "(genkey(ecdh(curve NIST-P256)(use-fips186)))" to generate public-private key pair based on ECC NIST P256 curve. 
 Now I need to generate shared secret key (ECDH agreement) using Local private key and remote public key. I see that, there is no single function like "ECDH_compute_key()" in openssl, to generate secret shared key.

After browsing lot of websites, white paper etc, I figured out that gcry_pk_encrypt() is suppose to be used to generate shared secret. But when I tried to use that function, it yielded me different shared secret. On client side, I am using client's private key and server's public key and on server side I am using Server's private key and client's public key.

Can anyone help me in this please, to generate shared secret key using Libgcrypt 1.8.5 version ?
Any help is highly appreciated.

Thank you in advance.
Best Regards,
Mandar

_____________________________________
Sent from http://gnupg.10057.n7.nabble.com




More information about the Gcrypt-devel mailing list