Topic: wc_ecc_import_raw is not working
Hello,
I'm trying out a sample code to load ECC keys generated using the OpenSSL command-line ( secp160r1) with wc_ecc_import_raw and the function is returning -140 as the return error code.
Step1 :
Here is the sample key I used
openssl ec -in pkey1.key -inform der -pubout -text -noout
read EC key
Private-Key: (161 bit)
priv:
4c:69:49:c4:7e:e0:7c:24:6a:3d:d5:90:45:81:0e:
ee:53:5c:a8:9d
pub:
04:76:9e:eb:0f:7e:11:71:81:7a:a0:01:7a:57:87:
43:23:dc:6f:f8:2c:c6:91:34:e6:c4:9a:ed:3c:3c:
fb:cb:c2:a8:9b:69:a9:8b:74:71:72
ASN1 OID: secp160r1
Step 2:
Then I converted the keys to the hex string format required by the wc_ecc_import_raw
const char *X = "769eeb0f7e1171817aa0017a57874323dc6ff82c";
const char *Y = "c69134e6c49aed3c3cfbcbc2a89b69a98b747172";
const char *privateKey ="4c6949c47ee07c246a3dd59045810eee535ca89d";
const char* curveName = "SECP160R1";
Step 3: Call the wc_ecc_import_raw method
wc_ecc_init(&eccKey)
wc_ecc_import_raw(&eccKey,X,Y,privateKey,curveName)
Any thoughts on what could be wrong?