cancel
Showing results for 
Search instead for 
Did you mean: 

Cryptolib: ECDSA Public key format

ABach.5
Associate

Hello,

I try to verify data with cmox_ecdsa_verify. It fails with CMOX_ECC_ERR_BAD_PARAMETERS. I think my public key has the wrong format, because the buffer CMOX_ECC_SECP384R1_PUBKEY_LEN is 96. My key has the length of 120 bytes.

I have exported my public with openssl. For example:

openssl ecparam -name secp384r1 -genkey -noout -out myprivate.key
openssl ec -in myprivate.key -pubout -out mypublic.der -outform DER

What format do I need? And is it possible to convert the OpenSSL key to the right format?

Thank you.

1 REPLY 1
Jocelyn RICARD
ST Employee

Hello @ABach.5​,

the key should be provided in its binary form.

Please use;

openssl ec -in myprivate.key -text

You will get there something like (among other information)

pub:

  04:75:f0:e3:8a:03:1d:84:46:31:08:5b:b3:0f:c8:

  b8:83:08:25:f2:bb:f1:85:f3:37:71:94:1d:17:21:

  cb:32:7d:b4:2d:74:d8:00:65:50:bb:c5:b4:d9:47:

  31:24:d5:67:03:4f:d1:15:c8:48:d8:6d:e0:41:10:

  8e:7c:06:70:4c:70:65:f8:f0:d7:77:fa:d2:78:4d:

  cb:f7:25:2b:30:ae:06:0d:d9:4f:79:f2:a5:e3:b4:

  d3:28:b1:bf:99:4f:0b

Just remove the leading byte (04) and you have your 96 bytes public key.

Best regards

Jocelyn