Error ECC curve: the public key isn´t on curve

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:

SERVER_PUBLIC_KEY = '043d1406c5c8dc3c35c3290aa16b897d740251f8d2022b28610743ccecee7d45d1d0165ee69ea244d2168177acf25af497af5f76f622f28ebcbf6943e64de36551';

ecc1:= TECCEncSign.Create;
ecc1.ECCType:= p256;
ecc1.OutputFormat:= base64;
ecc1.Unicode:= yesUni;

sharedSecret:= ecc1.GenerateSharedSecret(conv.HexaToBase64(SERVER_PUBLIC_KEY));

Thank you.

Hello, this may be a byte ordering issue. Will check.

I apreciate it


Did you try to import the key like this:

sharedSecret:= ecc.GenerateSharedSecret(ecc.FromPublicKey(SERVER_PUBLIC_KEY));


Hello, now the error is "Thi is not an EC publi key"