Page 1 of 1

how to define total length of ECC F2M 571bits signture

Posted: Wed Nov 04, 2015 7:30 am
by BirdKing
Hello,
when I compute a signature of ecc f2m 571bits, I get a result. But the result's length greater than 0x80. how to define total length of ECC F2M 571bits signture?

Re: how to define total length of ECC F2M 571bits signture

Posted: Thu Nov 05, 2015 11:23 pm
by UNKNwYSHSA
Have you tried to calculate the signature of this bits length using openssl?

Re: how to define total length of ECC F2M 571bits signture

Posted: Fri Nov 06, 2015 12:22 am
by BirdKing
UNKNwYSHSA wrote:Have you tried to calculate the signature of this bits length using openssl?

yes. I got a signature such as "30 81 94 02 ...".

Re: how to define total length of ECC F2M 571bits signture

Posted: Fri Nov 06, 2015 2:24 am
by UNKNwYSHSA
BirdKing wrote:
UNKNwYSHSA wrote:Have you tried to calculate the signature of this bits length using openssl?

yes. I got a signature such as "30 81 94 02 ...".

Please show me all signature data bytes!

Re: how to define total length of ECC F2M 571bits signture

Posted: Wed Nov 11, 2015 2:14 am
by UNKNwYSHSA
Here is the implement of function ECDSA_sign in openssl:

Code: Select all

int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char 
   *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r,
   EC_KEY *eckey)
{
   ECDSA_SIG *s;
   RAND_seed(dgst, dlen);
   s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey);
   if (s == NULL)
   {
      *siglen=0;
      return 0;
   }
   *siglen = i2d_ECDSA_SIG(s, &sig);
   ECDSA_SIG_free(s);
   return 1;
}

The signature data is encoded with DER format.
You can use the decode function

Code: Select all

d2i_ECDSA_SIG
to decode signature data.
Wait your message.

Re: how to define total length of ECC F2M 571bits signture

Posted: Tue Nov 17, 2015 4:34 am
by BirdKing
Thank you for your help.
I finally understood how to struct the R and S. Following the TLV, I can get the right signature.
Thank everybody.