Re: ECDSA test key/files
Aleksey Sanin <[email protected]> Fri, 3 Mar 2017 15:45:24 -0800
| Newsgroups | gmane.text.xml.xmlsec |
|---|---|
| Message-ID | <[email protected]> |
Yes, this sounds like a bug. Any chance you can also fix
OpenSSL implementation then?
Aleksey
On 3/3/17 3:21 PM, Miklos Vajna wrote:
> Hi,
>
> I found one more problem around the ECDSA test files.
>
> For example, tests/aleksey-xmldsig-01/enveloping-sha256-ecdsa-sha256.xml
> has a <SignatureValue> that is of 64 bytes after base64 decode.
>
> However, when I tried to test the signature verifier with other ECDSA
> testcases, the signature value was longer. Example:
> The last attachment to
> <https://bugs.documentfoundation.org/show_bug.cgi?id=105983> has a
> signature that looks like this:
>
> <SignatureValue xmlns="http://www.w3.org/2000/09/xmldsig#" Id="SignatureValue_4513a8b22f16c956d127c7844419ed2b006635af4e855d7f1d06ea9d49e4e8af">MEQCIHpA2WCOXQ5z7qcmtIU+LiPgh3WBUBga7Ny0sZ8Jh9FhAiB0Mr6G+9zMTmkuOOeVZmwuIcQjcSm5SPg+Gfi0T7cdcw==</SignatureValue>
>
> i.e. it's 70 bytes after base64 decode: it's 2 integers of 32 bytes, but
> it's ASN1 encoded.
>
> This difference made me curious: which one is incorrect?
>
> As far as I see this is specified in
> https://www.ietf.org/rfc/rfc3279.txt, section "2.2.3 ECDSA Signature
> Algorithm". It says:
>
> "To easily transfer these two
> values as one signature, they MUST be ASN.1 encoded using the
> following ASN.1 structure:
>
> Ecdsa-Sig-Value ::= SEQUENCE {
> r INTEGER,
> s INTEGER }"
>
> So to me, it looks like:
>
> - the xmlsec openssl backend doesn't do this encoding, even if it's a
> must according to the RFC
> - the test file tests this bad behavior
> - because i used the test files as a reference for the behavior, now I
> implemented the same in the nss backend as well
>
> Would it be OK if I change (send a pull request that changes) the test
> files to contain this required ASN1 encoding? Fixing the NSS backend is
> easy to read/write the encoded form, I can do that. I can also try to
> fix the openssl backend to conform to the RFC.
>
> Thanks,
>
> Miklos
>
>
>
> _______________________________________________
> xmlsec mailing list
> [email protected]
> http://www.aleksey.com/mailman/listinfo/xmlsec
>
_______________________________________________
xmlsec mailing list
[email protected]
http://www.aleksey.com/mailman/listinfo/xmlsec
signature.asc
(application/pgp-signature, 842 B)
-----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYugAYAAoJEEEbi2vACtCgbuMP/j+cENs42b2yudvNEph/eHfW S0IRf+/OPCeld7HkSjRx5rQ5rNjJYkD5bRa7ioH1NGWTvWc6FNBoRMWSpstM1ash GFnoiKrxEVnXG27RNaIyZqMIqXSveyS4PleZ2u1Ovqip1BIsI/3jcw8lzylfxTaM GmYVyRI6n14cGWOEnaLbGLi0q5qsUuCmdg1DX/acoGpSzALOAEPq6Jn8tk4OFwf6 Ppi+CPAcqInEbHaHRo33cdk6vQC1YwfF2O7oOU9XUYUp3otGULCGiIQ7tYDehPId x+nEhJgzWZTB5JY7x7F58TbRiyciK+u7Bzo914D55kLLRX3XKMgELCs31/tWh07M vwd5TKk64QdB5DOQ9CCuiLQQwCOLV08g5YEKlUgXuPnQw5569QOC3790yIVRXH8i 4wzedPSK0Q3Hqdag7+r+1vJUH2OOafbH/WjHoFqrtDuDcsXMeZ62m8EO6KgYmglp 2hZ+SmfWf146sy1FnhbQUeJwkhj8vftoM6JPCinBYU2iaRWIg7+6iShmcVMIdI9d IFqqoovts+ITUFCPpyDFSA9V1xsRiuAzh0MSLFdOw15f5nenmi8WVHMf8ro3phxN xzKHiNc2goP3NobUhX0+cTwHdo1h9abS4Tuk52Zz2wjBF8SRG9HgkNQZP8t9bNEW BwEoL7vOxKuUyy1x/j44 =Xj7A -----END PGP SIGNATURE-----