<?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=3&amp;t=124" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2008-07-02T15:03:13+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=3&amp;t=124</id>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-07-02T15:03:13+01:00</updated>
<published>2008-07-02T15:03:13+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=404#p404</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=404#p404"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=404#p404"><![CDATA[
I'm happy that this could be resolved so easily.<br /><br />The first line of the API documentation says:<br /><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />All requests are HTTP GETs. As such, all parameters must be properly URL encoded.<br /></div><br /><br /><img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><br /><br />However, I agree it is easy to miss why that is important, so I added some details:<br /><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />In particular, some base64 characters (such as &quot;+&quot;) in the value fields needs to be scaped.<br /></div><br /><br />See: <!-- m --><a class="postlink" href="http://yubico.com/developers/api/">http://yubico.com/developers/api/</a><!-- m --><br /><br />Thanks,<br />Simon<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2">Simon</a> — Wed Jul 02, 2008 3:03 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[yoshir]]></name></author>
<updated>2008-07-01T15:26:31+01:00</updated>
<published>2008-07-01T15:26:31+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=399#p399</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=399#p399"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=399#p399"><![CDATA[
Yes,<br /><br />URLEncoding worked. every call was successfull<br /><br />For java I used URLEncoder.encode(string, &quot;UTF-8&quot;);<br /><br />I agree with Tony that mentioning URLencoding is needed in a sample code or as a step in the web service api page under developer section<br /><br /><br />Thanks<br /><br />Ron<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=183">yoshir</a> — Tue Jul 01, 2008 3:26 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jester]]></name></author>
<updated>2008-07-01T12:09:35+01:00</updated>
<published>2008-07-01T12:09:35+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=396#p396</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=396#p396"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=396#p396"><![CDATA[
Of course  <img src="https://forum.yubico.com/images/smilies/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" />  -- good spot, Simon,<br /><br />I have added a URL encode and it has solved the problem.  You may want to add this to the sample code on the google sites.<br /><br />For C# use the System.Web.HttpUtility.UrlEncode(string).<br /><br />Tony<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=177">Jester</a> — Tue Jul 01, 2008 12:09 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-07-01T11:35:29+01:00</updated>
<published>2008-07-01T11:35:29+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=395#p395</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=395#p395"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=395#p395"><![CDATA[
Thank you very much for posting the log, it allowed me to find the problem quickly.<br /><br />Did you notice that all of the requests that do not succeed contain '+' in the signature field?  And that all requests that succeed does not contain a '+' in the signature field?  This is your problem, sending a '+' value in a HTTP GET URL requires escaping, so you need to escape it.<br /><br />/Simon<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2">Simon</a> — Tue Jul 01, 2008 11:35 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jester]]></name></author>
<updated>2008-07-01T10:04:51+01:00</updated>
<published>2008-07-01T10:04:51+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=393#p393</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=393#p393"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=393#p393"><![CDATA[
Here is my log.  I assume the API KEY is a secret, so I have registered another one to use here and for development (auth id 180).  It made no difference to the number of bad signature responses.<br /><br />You already have my code, which is in C#.<br /><br />Tony<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=177">Jester</a> — Tue Jul 01, 2008 10:04 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[yoshir]]></name></author>
<updated>2008-07-01T03:11:23+01:00</updated>
<published>2008-07-01T03:11:23+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=390#p390</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=390#p390"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=390#p390"><![CDATA[
Hi <br /><br />Attached is the logging. I hope this is ok.<br /><br />I also attached my servlet program I used to produce the log.<br /><br />The only thing I can think of is the base64 class used to encode base64.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=183">yoshir</a> — Tue Jul 01, 2008 3:11 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jester]]></name></author>
<updated>2008-06-30T15:32:37+01:00</updated>
<published>2008-06-30T15:32:37+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=382#p382</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=382#p382"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=382#p382"><![CDATA[
Thanks - when you say post a debug log, do you mean a list of otps, signatures with pass and fail?<br /><br />Tony<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=177">Jester</a> — Mon Jun 30, 2008 3:32 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-06-30T15:15:36+01:00</updated>
<published>2008-06-30T15:15:36+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=379#p379</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=379#p379"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=379#p379"><![CDATA[
Could you log the requests to see which attempts work and which doesn't work for you?<br /><br />Possibly it could be URL encoding that doesn't work, or some other pattern that we can detect if we see a debug log if 15-20 attempts where some work and some doesn't work.<br /><br />/Simon<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2">Simon</a> — Mon Jun 30, 2008 3:15 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jester]]></name></author>
<updated>2008-06-30T13:27:27+01:00</updated>
<published>2008-06-30T13:27:27+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=375#p375</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=375#p375"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=375#p375"><![CDATA[
Ron,<br /><br />This is interesting as we are seeing a very similar thing.  The key seems to work fine for a while, but then required between 3-6 attempts before the key is accepted.<br /><br />Puzzling  <img src="https://forum.yubico.com/images/smilies/icon_e_confused.gif" alt=":?" title="Confused" />   I have emailed support and waiting a response.<br /><br />Tony<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=177">Jester</a> — Mon Jun 30, 2008 1:27 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[yoshir]]></name></author>
<updated>2008-06-28T16:58:19+01:00</updated>
<published>2008-06-28T16:58:19+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=373#p373</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=373#p373"/>
<title type="html"><![CDATA[Re: Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=373#p373"><![CDATA[
I did some further testing and I got an OK status. But some times I get a BAD SIGNATURE status. <br /><br />Is there a reason why somethimes it is OK and others it returns a BAD SIGNATURE?<br /><br />Ron<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=183">yoshir</a> — Sat Jun 28, 2008 4:58 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[yoshir]]></name></author>
<updated>2008-06-28T04:25:52+01:00</updated>
<published>2008-06-28T04:25:52+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=124&amp;p=372#p372</id>
<link href="https://forum.yubico.com/viewtopic.php?t=124&amp;p=372#p372"/>
<title type="html"><![CDATA[Problem with BAD SIGNATURE in java]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=124&amp;p=372#p372"><![CDATA[
Hi<br /><br />I am trying to use the signature portion to verify my Yubikey, I am not sure what I am doing wrong.<br /><br />Below is part of the code.<br />=============================================================================================<br />Note:_clientid and hKey is from the online API key generator<br />=============================================================================================<br />String text = &quot;id=&quot; + _clientId + &quot;&amp;otp=&quot; + otp;<br /><br />String b64Encoded = sign(text,hKey);<br /><br />URL srv = new URL(YUBICO_AUTH_SRV_URL + _clientId + &quot;&amp;otp=&quot; + otp + &quot;&amp;h=&quot; + b64Encoded );<br />...<br /><br />public static String sign(String what, String secret)<br />throws IllegalArgumentException {<br />try {<br /><br /><br />byte[] b = hmacSha1(Base64.decode(secret), what.getBytes(&quot;UTF-8&quot;));<br />String s = Base64.encode(b);<br />s = s.replaceAll(&quot;\n&quot;, &quot;&quot;);<br />return s;<br />} catch (UnsupportedEncodingException e) {<br />throw new IllegalArgumentException(e);<br />} catch (IOException e) {<br />// TODO Auto-generated catch block<br />e.printStackTrace();<br />throw new IllegalArgumentException(e);<br />}<br />}<br /><br />private static byte[] hmacSha1(byte[] key, byte[] text)<br />throws IllegalArgumentException {<br />try {<br />SecretKey sk = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);<br />Mac m = Mac.getInstance(sk.getAlgorithm());<br />m.init(sk);<br />return m.doFinal(text);<br />} catch (InvalidKeyException e) {<br />throw new IllegalArgumentException(e);<br />} catch (NoSuchAlgorithmException e) {<br />throw new IllegalArgumentException(e);<br />}<br />}<br /><br />=============================================================================<br /><br />Thanks<br /><br />Ron<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=183">yoshir</a> — Sat Jun 28, 2008 4:25 am</p><hr />
]]></content>
</entry>
</feed>