<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=33&amp;t=2048" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2015-09-29T15:02:26+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=33&amp;t=2048</id>
<entry>
<author><name><![CDATA[corny]]></name></author>
<updated>2015-09-29T15:02:26+01:00</updated>
<published>2015-09-29T15:02:26+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2048&amp;p=7850#p7850</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2048&amp;p=7850#p7850"/>
<title type="html"><![CDATA[Re: Wrong signature length of an U2F response?]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2048&amp;p=7850#p7850"><![CDATA[
Bummer.<br /><br />I realized, that sometimes the two values vr and vs are 33/32 or 32/33 bytes.<br />Sometimes 32/32 and then the signature worked.<br /><br />Reading a bit deeper I realized, that it is due to the DER encoding, that a 33byte length value starts with a \0x00, which needs to bedropped, when verifying the signature.<br /><br />Now everything works fine.<br /><br />(if I new how to mark this thing as solved)<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2703">corny</a> — Tue Sep 29, 2015 3:02 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[corny]]></name></author>
<updated>2015-09-29T14:41:31+01:00</updated>
<published>2015-09-29T14:41:31+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2048&amp;p=7849#p7849</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2048&amp;p=7849#p7849"/>
<title type="html"><![CDATA[Wrong signature length of an U2F response?]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2048&amp;p=7849#p7849"><![CDATA[
Hi,<br />I am implementing U2F in python.<br /><br />I registered a u2f device, send a challenge and I am getting the response.<br /><br />I run my unittest against the values from <br /><!-- m --><a class="postlink" href="https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html#authentication-example">https://fidoalliance.org/specs/fido-u2f ... on-example</a><!-- m --><br />which works out fine.<br /><br />They give an example signature like:<br /><br />&quot;304402204b5f0cd17534cedd8c34ee09570ef542a353df4436030ce43d406de870b847780220267bb998fac9b7266eb60e7cb0b5eabdfd5ba9614f53c7b22272ec10047a923f&quot;<br /><br />To my understanding this is DER encoded.<br />which is very well explained here<br /><!-- m --><a class="postlink" href="http://crypto.stackexchange.com/questions/1795/how-can-i-convert-a-der-ecdsa-signature-to-asn-1">http://crypto.stackexchange.com/questio ... e-to-asn-1</a><!-- m --><br /><br />So after the first byte 0x32 I get 0x44, which is 68 (minus the 4 bytes markes and length) I get a raw signature length of 64 bytes.<br /><br />I am using python-edcsa. Putting this into my code<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">    vkey = ecdsa.VerifyingKey.from_string(user_pub_key_bin,<br />                                          curve=ecdsa.NIST256p,<br />                                          hashfunc=sha256)<br />    vkey.verify(signature_bin_asn, input_data)</div><br /><br />works out just fine.<br />Great. Now going live. I registered the blue yubikey u2f and am now doing a challenge request.<br />The response gives me this signature:<br /><br />'3046022100ff57770dfcdf1bcb80f303459215a23577b3fcffcf48ce70c589cd5620b3524c022100daa4ed2727477b95a91185fc30aa7488a47370cf4a3551c208e6709b445bc2a4'<br /><br />The second byte gives me a remaining length of 70 bytes and I end up with a raw signature length of 66 bytes.<br />Is this really correct?<br /><br />Feeding this into python-edcsa gives me an assertion, since it expects a signature length of 64.<br /><br />Thanks for any insight.<br /><br />Kind regards<br />Cornelius<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2703">corny</a> — Tue Sep 29, 2015 2:41 pm</p><hr />
]]></content>
</entry>
</feed>