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

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

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=5&amp;t=61</id>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-07-02T14:38:48+01:00</updated>
<published>2008-07-02T14:38:48+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=401#p401</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=401#p401"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=401#p401"><![CDATA[
<div class="quotetitle">hasterguf wrote:</div><div class="quotecontent"><br />Hi Simon,<br /><br />I opened a an account at code.google.com to host the class.<br />You can find it here: <!-- m --><a class="postlink" href="http://code.google.com/p/yubiclass/">http://code.google.com/p/yubiclass/</a><!-- m --><br /></div><br /><br />Alex, thanks!  We have now linked this from our official pages:<br /><br /><!-- m --><a class="postlink" href="http://yubico.com/developers/library/">http://yubico.com/developers/library/</a><!-- m --><br /><br />I hope you'll get more traffic to it. <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><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 2:38 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-06-11T19:23:18+01:00</updated>
<published>2008-06-11T19:23:18+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=239#p239</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=239#p239"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=239#p239"><![CDATA[
I removed all the old code from my original site! From now on the entire project is on code.google.com<br /><br />Best regards,<br />   Alex<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Wed Jun 11, 2008 7:23 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-06-10T18:17:54+01:00</updated>
<published>2008-06-10T18:17:54+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=231#p231</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=231#p231"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=231#p231"><![CDATA[
Hi Simon,<br /><br />I opened a an account at code.google.com to host the class.<br />You can find it here: <!-- m --><a class="postlink" href="http://code.google.com/p/yubiclass/">http://code.google.com/p/yubiclass/</a><!-- m --><br /><br />I changed the version to 0.6 to keep track of the fact that i moved it from my old site to google.<br /><br />Best regards,<br />   Alex<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Tue Jun 10, 2008 6:17 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-06-10T09:38:09+01:00</updated>
<published>2008-06-10T09:38:09+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=225#p225</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=225#p225"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=225#p225"><![CDATA[
Alex: It would be great to be able to collaborately improve your work.  We have been using Google Code, which supports SVN, successfully.  I like their clean interface.  I've used sourceforge in the past, but find that it is a bit too complex and contains a lot of advertisement everywhere.  But I don't care strongly, and it is your project after all. <img src="https://forum.yubico.com/images/smilies/icon_e_wink.gif" alt=";-)" title="Wink" /><br /><br />/Simon<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2">Simon</a> — Tue Jun 10, 2008 9:38 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-06-09T16:50:19+01:00</updated>
<published>2008-06-09T16:50:19+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=198#p198</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=198#p198"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=198#p198"><![CDATA[
Hi <br /><br />jwoltman: Congratulations on you new yubikey <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /> Don't keep pushing the button all night <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /> And thank you very much for your help about the class abstractions. I am looking forward to seeing a SQlite class from you, if you get the time to make it <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><br /><br />Simon: It sounds like a good idea - do you have any preferences? I was thinking about sourceforge - I never tried it before, but it looks like that they have good versioning possibilities. Do you have any better suggestions?<br /><br />Best regards,<br />  Alex<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Mon Jun 09, 2008 4:50 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jwoltman]]></name></author>
<updated>2008-06-09T12:56:42+01:00</updated>
<published>2008-06-09T12:56:42+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=194#p194</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=194#p194"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=194#p194"><![CDATA[
Hello everyone, got my Yubikey and I can now login to the forums!  Tonight I plan on trying some new things with my Yubikey, and will post the results either here or in a new thread.  Cheers!<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=125">jwoltman</a> — Mon Jun 09, 2008 12:56 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-06-09T08:34:25+01:00</updated>
<published>2008-06-09T08:34:25+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=188#p188</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=188#p188"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=188#p188"><![CDATA[
Wow, many thanks for continuing working on this!<br /><br />We have been busy with production issues, but I think we are close to deciding on how to proceed with an open source based server.  I need to take a more careful look at the code, but do you think it would be possible to develop this code in a version control system somewhere?  Then people from yubico will put more time into it, and we can even begin advertising it as our open source server and write documentation for it.  What do you think?<br /><br />/Simon<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2">Simon</a> — Mon Jun 09, 2008 8:34 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-06-06T10:21:07+01:00</updated>
<published>2008-06-06T10:21:07+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=175#p175</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=175#p175"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=175#p175"><![CDATA[
By some help from Mr. John Woltman I restructured the class making it easy to extend the class with your own key-store. You could do that if you don't like MySQL or the provided ini-file option.<br /><br />Sources, examples and online tests are here: <!-- m --><a class="postlink" href="http://zyz.dk/yk/class_0.5/">http://zyz.dk/yk/class_0.5/</a><!-- m --><br /><br />Best regards,<br />   Alex Jensen<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Fri Jun 06, 2008 10:21 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-06-05T17:17:48+01:00</updated>
<published>2008-06-05T17:17:48+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=167#p167</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=167#p167"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=167#p167"><![CDATA[
Here is version 0.3 of my Yubikey PHP class...<br /><br />Now you can do:<br />1) simple decryption (with no backend database). You should handle the counters to prevent replay-attacks<br />2) OTP authentication, preventing replay-attacks using MySQL as backend.<br />3) OTP authentication, preventing replay-attacks using an INI-file as backend. This makes the setup very simple.<br /><br />You can find the code and examples here: <!-- m --><a class="postlink" href="http://zyz.dk/yk/class_0.3">http://zyz.dk/yk/class_0.3</a><!-- m --><br /><br />Best regards,<br />   Alex Jensen<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Thu Jun 05, 2008 5:17 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-05-28T21:29:04+01:00</updated>
<published>2008-05-28T21:29:04+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=96#p96</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=96#p96"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=96#p96"><![CDATA[
Here is my readymade class complete with check for OTP replays!!!! You first need to set up a table on a mysql-server in order to store the secret AES keys and the session counters. You do that by using the included SQL-script first. The yubikey_test.php is a running example using the class. It provides almost all usefull information about the yubikey.<br /><br /><!-- m --><a class="postlink" href="http://zyz.dk/yk/class_0.2/sql.html">http://zyz.dk/yk/class_0.2/sql.html</a><!-- m --><br /><!-- m --><a class="postlink" href="http://zyz.dk/yk/class_0.2/yubikey.php.html">http://zyz.dk/yk/class_0.2/yubikey.php.html</a><!-- m --><br /><!-- m --><a class="postlink" href="http://zyz.dk/yk/class_0.2/yubikey_test.php.html">http://zyz.dk/yk/class_0.2/yubikey_test.php.html</a><!-- m --><br /><br />I hope this is better than my first script <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><br /><br />You still need to download the AES128 class from <!-- m --><a class="postlink" href="http://www.phpclasses.org/browse/package/3650.html">http://www.phpclasses.org/browse/package/3650.html</a><!-- m --> and place it in the same directory. You can get my copy of that library from: <!-- m --><a class="postlink" href="http://zyz.dk/yk/class_0.2/AES128.php.html">http://zyz.dk/yk/class_0.2/AES128.php.html</a><!-- m --><br /><br />Best regards,<br />   Alex<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Wed May 28, 2008 9:29 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Simon]]></name></author>
<updated>2008-05-28T17:47:58+01:00</updated>
<published>2008-05-28T17:47:58+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=84#p84</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=84#p84"/>
<title type="html"><![CDATA[Re: My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=84#p84"><![CDATA[
Wow, many thanks for sharing this code!<br /><br />I know that John Woltam has been working on a PHP port as well, and has sent early copies to me.  He was going to create a google code project for this tonight, and maybe we can all join that project and maybe pick the best parts from each implementation?<br /><br />It seems your code may be somewhat shorter... but let's wait with comparison until both are available.<br /><br />It seems this should be packaged as a PHP class somehow.  A PEAR module perhaps?  I dunno.<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 May 28, 2008 5:47 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hasterguf]]></name></author>
<updated>2008-05-26T21:56:46+01:00</updated>
<published>2008-05-26T21:56:46+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=61&amp;p=76#p76</id>
<link href="https://forum.yubico.com/viewtopic.php?t=61&amp;p=76#p76"/>
<title type="html"><![CDATA[My PHP implementation of the yubikey decryption...]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=61&amp;p=76#p76"><![CDATA[
Hi,<br /><br />Here is my first implementation of a function for PHP that decrypts an OPT-string from a yubikey. It works completely independent of yubico's servers. The only thing you need to change in the code is the AES-key of your yubikey. This code does <strong>not</strong> check for OTP-replays! it's your job to check the counter and the sessioncounter! <br /><br />Just put the code on your webserver together with the AES128-class you can download from here: <!-- m --><a class="postlink" href="http://www.phpclasses.org/browse/file/17721.html">http://www.phpclasses.org/browse/file/17721.html</a><!-- m --><br /><br /><strong>way of calling: </strong><br />decode_yubistring($ystring,$secret_aes_key)<br /><br />ystring: String from the yubikey<br />secret_aes_key: your 128 bit AES-key presented in HEX<br /><br /><strong>returns array:</strong><br />publicID: The first part of the OPT-string. Normally the id of your yubikey<br /><br />token: The last 32 yubikey characters of the OPT-string. This is going to be decrypted<br />token_bin: Token presented binary.<br />token_hex: Token presented in hex.<br /><br />aeskey_bin: Your secret AES-key in binary format<br />aeskey_hex: Your secret AES-key in hex<br /><br />token_decoded_bin: Decoded token in binary format<br />token_decoded_hex: Decoded token in hex<br /><br />secretID_bin: Decrypted secret ID<br />secretID_hex: Decrypted secret ID in hex<br />counter: Decrypted number of times the yubikey has been powered up<br />counter_session: Decrypted number of times the yubikey has been pressed since last power up<br />timestamp: Decrypted number of 1/8sek since power up<br />random: Decrypted random number generated by the yubikey<br />crc: Decrypted CRC checksom generated by the yubikey<br /><br />crc_ok=True if the checksum of the decrypted data is ok. Always check this!<br /><br /><strong>Here comes my sourcecode:</strong><br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">&lt;html&gt;<br />   &lt;head&gt;&lt;/head&gt;<br />   &lt;body&gt;<br />      &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo $PHP_SELF; ?&gt;&quot;&gt;<br />         Press your Yubikey:<br />         &lt;input type=&quot;text&quot; name=&quot;yubistring&quot; size=&quot;50&quot;&gt;<br />         &lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;<br />      &lt;/form&gt;<br /><br />      &lt;?PHP<br />         /*<br />            PHP yubikey decryptor v0.1 by Alex Skov Jensen. <br />            <br />            This program will ONLY decrypt data from your key. You have to check the crc_ok, counter and counter_session variables in order to very prevent OTP-replays!<br /><br />            You need to download the AES128 library from: http://www.phpclasses.org/browse/file/17721.html in order to use this program<br />            Call decode_yubistring($yubistring,$aes_key) function. Function returnes an array with all decrypted information from the yubikey.<br />         */<br />         <br />         // The secret AES key of your yubikey - the only parameter you need to set!<br />         $secret_aes_key=&quot;802dce501d8547d6832a48c5da0c89af&quot;;<br /><br />         $t=decode_yubistring($_POST&#91;&quot;yubistring&quot;&#93;,$secret_aes_key);<br />         while (list($key, $value) = each($t)) echo &quot;$key=$value&lt;br /&gt;\n&quot;;<br /><br /><br />         function decode_yubistring($ystring,$secret_aes_key)<br />         {<br />            require_once('AES128.php');<br />            $aes=new AES128();<br />            $key=$aes-&gt;makeKey(pack('H*',$secret_aes_key));<br /><br />            $ydec=array();<br />            if (strlen($ystring)&gt;=32)<br />            {<br />               $ydec&#91;&quot;token&quot;&#93;=substr($ystring,-32);<br />               $ydec&#91;&quot;publicID&quot;&#93;=substr($ystring,0,strlen($ystring)-32);<br />               $ydec&#91;&quot;token_bin&quot;&#93;=modhex_decode($ydec&#91;&quot;token&quot;&#93;);<br />               $ydec&#91;&quot;token_hex&quot;&#93;=bin2hex($ydec&#91;&quot;token_bin&quot;&#93;);<br />               $ydec&#91;&quot;aeskey_bin&quot;&#93;=pack('H*',$secret_aes_key);<br />               $ydec&#91;&quot;aeskey_hex&quot;&#93;=$secret_aes_key;<br />               $ydec&#91;&quot;token_decoded_bin&quot;&#93;=$aes-&gt;blockDecrypt($ydec&#91;&quot;token_bin&quot;&#93;, $key);<br />               $ydec&#91;&quot;token_decoded_hex&quot;&#93;=bin2hex($ydec&#91;&quot;token_decoded_bin&quot;&#93;);<br />               $ydec&#91;&quot;secretID_bin&quot;&#93;=substr($ydec&#91;&quot;token_decoded_bin&quot;&#93;,0,6);<br />               $ydec&#91;&quot;secretID_hex&quot;&#93;=bin2hex($ydec&#91;&quot;secretID_bin&quot;&#93;);<br />               $ydec&#91;&quot;counter&quot;&#93;=ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;7&#93;)*256+ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;6&#93;);<br />               $ydec&#91;&quot;counter_session&quot;&#93;=ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;11&#93;);<br />               $ydec&#91;&quot;timestamp&quot;&#93;=ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;10&#93;)*65536+ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;9&#93;)*256+ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;8&#93;);<br />               $ydec&#91;&quot;random&quot;&#93;=ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;13&#93;)*256+ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;12&#93;);<br />               $ydec&#91;&quot;crc&quot;&#93;=ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;15&#93;)*256+ord($ydec&#91;&quot;token_decoded_bin&quot;&#93;&#91;14&#93;);<br />               $ydec&#91;&quot;crc_ok&quot;&#93;=crc_check($ydec&#91;&quot;token_decoded_bin&quot;&#93;);<br />               }<br />            return $ydec;<br />         }<br /><br />         function crc_check($buffer)<br />         {<br />            $m_crc=0xffff;<br />            for($bpos=0; $bpos&lt;16; $bpos++)<br />            {<br />               $m_crc ^= ord($buffer&#91;$bpos&#93;) &amp; 0xff;<br />               for ($i=0; $i&lt;8; $i++)<br />               {<br />                  $j=$m_crc &amp; 1;<br />                  $m_crc &gt;&gt;= 1;<br />                  if ($j) $m_crc ^= 0x8408;<br />               }<br />            }<br />            return $m_crc==0xf0b8;<br />         }<br /><br />         function modhex_decode($mstring)<br />         {<br />            $cset=&quot;cbdefghijklnrtuv&quot;;<br />            $decoded=&quot;&quot;;<br />            $hbyte=0;<br />            for ($i=0; $i&lt;strlen($mstring);$i++)<br />            {<br />               $pos=strpos($cset,$mstring&#91;$i&#93;);<br />               if ($i/2-round($i/2))<br />               {<br />                  $decoded.=chr($hbyte+$pos);<br />                  $hbyte=0;<br />               } else $hbyte=$pos*16;<br />            }<br />            return $decoded;<br />         }<br />      ?&gt;<br /><br />   &lt;/body&gt;<br />&lt;/html&gt;<br /></div><br /><br />I hope that you can use it <img src="https://forum.yubico.com/images/smilies/icon_e_biggrin.gif" alt=":D" title="Very Happy" /> Comments are welcome<br /><br />Best regards,<br />   Alex.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=76">hasterguf</a> — Mon May 26, 2008 9:56 pm</p><hr />
]]></content>
</entry>
</feed>