You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Scott Cantor (Jira)" <ji...@apache.org> on 2021/10/28 18:19:00 UTC

[jira] [Commented] (SANTUARIO-498) DSA signature generation is unreliable

    [ https://issues.apache.org/jira/browse/SANTUARIO-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17435609#comment-17435609 ] 

Scott Cantor commented on SANTUARIO-498:
----------------------------------------

The specific issue is that the BN method with the pad suffix is only present on >=1.1

I'm sure there's an alternative workaround, but it's not in scope for me to deal with that, so I'll leave the original code there for older versions.

> DSA signature generation is unreliable
> --------------------------------------
>
>                 Key: SANTUARIO-498
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-498
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 2.0.2
>            Reporter: Ferenc Wágner
>            Assignee: Scott Cantor
>            Priority: Major
>             Fix For: C++ 2.0.3, C++ 2.0.4
>
>         Attachments: dsa.patch
>
>
> The XMLDSIG specification requires a straight big-endian binary encoding of _r_ and _s_:
> {quote}The signature value consists of the base64 encoding of the concatenation of two octet-streams that respectively result from the octet-encoding of the values r and s in that order. Integer to octet-stream conversion must be done according to the I2OSP operation defined in the RFC 3447 [PKCS1] specification with a l parameter equal to 20.
> {quote}
> However, the current code does not zero-pad the values to 20 bytes, leading to _Signature Lenght Incorrect_ messages during verify. Moreover, it allocates _rawSigBuf_ based on bit sizes, but writes into it with byte granularity. If both _r_ and _s_ are (say) 156 bits, they are still 20 bytes each, but _rawSigBuf_ is allocated 39 bytes only, one less than necessary.
> The attached patch made signature generation with 160-bit _q_-s work reliably for me. I'd be interested to hear how bigger signatures should be handled according to the DSIG specification; I tried to find out but failed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)