DSA signatures in OpenSSL 3.0

Richard Dymond rjdymond at gmail.com
Mon Mar 14 16:09:01 UTC 2022


On Mon, 14 Mar 2022 at 11:03, Tomas Mraz <tomas at openssl.org> wrote:

> On Mon, 2022-03-14 at 08:58 -0300, Richard Dymond wrote:
> > By the way, the reason I need to get the 'r' and 's' values from the
> > DSA signature is that I am encoding them one after the other as 160-
> > bit unsigned integers, in network byte order, as required by SSH and
> > described in section 6.6 of RFC 4253 (dss_signature_blob)[1]. To do
> > this encoding I am calling BN_bn2bin() twice to write 'r' followed by
> > 's' at the appropriate locations in a 40-byte buffer. By any chance,
> > does OpenSSL 3.0 provide any support for encoding a DSA signature
> > like this from a DSA_SIG (i.e. without having to extract 'r' and 's'
> > first and then use BN_bn2bin())?
>
> No, there is no such function. However there is not much overhead in
> doing the two BN_bn2bin calls (should those be BN_bn2binpad actually?)
> once you already have a DSA_SIG object.
>

OK, I suppose that was hoping for too much. But thanks for the tip
regarding BN_bn2binpad v. BN_bn2bin - that does simplify the code a little
more.

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/fa41e42b/attachment.htm>


More information about the openssl-users mailing list