Hello, in one of my projects I need to calculate the ECDH shared secret, I have started to carry out a test with the demo that is included. The curve I need is p256k1, which I assume will be the same as p256, but I always get the same error when calculating the shared secret: "the public key isn't on curve".
To do the test from Windows I create the key with the following command:
openssl ecparam -out ecc.key -name secp256k1 -genkey
openssl ec -in ecc.key -noout -text
Any idea what I'm doing wrong?
Is p265 different than p256k1?
This is the code I'm trying:
const
SERVER_PUBLIC_KEY = '043d1406c5c8dc3c35c3290aa16b897d740251f8d2022b28610743ccecee7d45d1d0165ee69ea244d2168177acf25af497af5f76f622f28ebcbf6943e64de36551';
ecc1:= TECCEncSign.Create;
ecc1.ECCType:= p256;
ecc1.OutputFormat:= base64;
ecc1.Unicode:= yesUni;
ecc1.GenerateKeys;
sharedSecret:= ecc1.GenerateSharedSecret(conv.HexaToBase64(SERVER_PUBLIC_KEY));
Thank you.