[gnutls-help] How to encode/decode ECDSA signatures to raw format

Nikos Mavrogiannopoulos nmav at gnutls.org
Fri May 26 09:05:24 CEST 2017


On Thu, May 25, 2017 at 9:01 PM, Nicolas Mora <nicolas at babelouest.org> wrote:
> Hello,
>
>>
>> Unfortunately there isn't any such function. Since 3.5.x there is an
>> exported, but still internal function _gnutls_decode_ber_rs_raw() for
>> that. I created an issue to export them for 3.6.0, but until then you
>> may want to replicate them to use them.
>>
>
> Thanks for the answer,
>
> There goes another question related to _gnutls_decode_ber_rs_raw(). When I
> use it with a newly created signature, I got 2 output parameters R and S.
> Each of them have a size parameter of 48 or 49, whatever the algorithm size
> used.

The integers returned by that function are (left) zero-padded to avoid
having them interpreted as negative integers. About the size being 48
or 49 irrespective of key, it seems something is wrong there. Most
likely you are using the SECP384 curve. If not could you send a small
reproducer?

regards,
Nikos



More information about the Gnutls-help mailing list