1 (edited by manoj.ramachandran 2017-11-08 06:49:26)

Topic: Signature convertion

I want to convert the signature  R and S portions of an ECC signature into a DER-encoded ECDSA signature

ret = wc_ecc_sign_hash(Random, u8RandLen, out, &x, &rng, &cliKey); 
//To convert ecc signature to r and s
  ret = wc_ecc_sig_to_rs(out,x,r,&sr,s,&ss);  (Till this it is working fine)

but while trying to  convert back with below function I am getting 0xFFFFFF87 as return status. Please help.
  x =sizeof(out);

ret = wc_ecc_rs_to_sig(r,s,out,&x);

Manoj Chandran R


Re: Signature convertion

Hi Manoj,

Which version of wolfSSL are you working with?

wc_ecc_sig_to_rs returns a binary array (1's and 0's) while wc_ecc_rs_to_sig expects a hex array input which is then converted to binary using our HexToBin function.

Did you go straight from wc_ecc_sig_to_rs to calling wc_ecc_rs_to_sig without converting from binary to hex first?

Could you describe your use case for us? Why are you trying to convert from sig_to_rs and then back again?

Warmest Regards,