This repository has been archived by the owner on May 9, 2023. It is now read-only.
formatSignature can not take output of calculateSignature since it already adds ASN.1 lenghts #7
Labels
bug
Something isn't working
Hey
I was trying to verify a signature generated by this library using openssl on my computer.
It did not work until I finally discovered this issue
Since OpenSSL likes Signatures in the ASN.1 menthod I took the convenient function
formatSignature
like this:Theoretically that should be fine, or did I misunderstand something?
As it is this does not work correctly though because the calculate Signature function will already add the
02 20
tags and the00
for negative values before the r and s numbers. When I then use the formatSignature function they are added again and the rest of the buffer, so 4-6 bytes of the actual signature are discarded. Then verification of course does not workWhen I take the data coming out of calculateSignature and add 0x30 and the length infront of it I get the correct ASN.1 format
Either I did not understand how this is supposed to be used or this is definitly a bug, in the first case pls still add this to the docs!
Thanks
The text was updated successfully, but these errors were encountered: