<?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=333" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2009-06-29T07:54:11+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=3&amp;t=333</id>
<entry>
<author><name><![CDATA[fortean]]></name></author>
<updated>2009-06-29T07:54:11+01:00</updated>
<published>2009-06-29T07:54:11+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1533#p1533</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1533#p1533"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1533#p1533"><![CDATA[
[quote=&quot;fortean&quot;].. PHP code ..[quote]<br /><br />As as sidenote: this code does not check for possible man-in-the-middle attacks; to do this you'll need to decipher the 'h' field with your private AES key (which you received when you registered your API id) and verify the decoded contents.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=682">fortean</a> — Mon Jun 29, 2009 7:54 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[fortean]]></name></author>
<updated>2009-06-26T19:12:21+01:00</updated>
<published>2009-06-26T19:12:21+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1525#p1525</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1525#p1525"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1525#p1525"><![CDATA[
<div class="quotetitle">ramonsky wrote:</div><div class="quotecontent"><br />I'm interested in this topic too, as I'm a web developer. <br /><br />I've read the documentation, but I'm still confused. I don't get all those extra parameters.<br /><br />All I want to be able to do is ask the user for ONE parameter (the OTP), pass it to the API, and get back the answer &quot;Yes&quot; or &quot;No&quot;. How do I do that? (I'm happy to rely on Yubico's servers, and I don't want to reflash my Yubikey).<br /></div><br /><br />Well, allright, as I had to write one myself, why not share it. Note that I choose to put this code in the public domain, folks. <br /><br />I created this little class and an example. The code works fine with PHP4 (haven't tested with PHP5, but it probably will work too). Probably, the standard classes available to work with HTTP stuff (HttpRequest::*) will do fine too and there is a lot of other code available. Anyway, this is my solution.<br /><br />PS: to get exactly what you wanted, you can simply test for the value in $r-&gt;stat, it is either &quot;OK&quot; - (substitute 'YES' then) or it is not (substitute &quot;NO&quot; then).<br />PS2: I have put part of the url inside the class, not sure if that was a good decision, but you can change it easily.<br />PS3: in this snippet the class is part of the file. However, you probably will want to store the class in its own file and 'require_once' it in. <br />PS4: as said, you'll need to register your own API key (and the OTP in this example is bogus too of course);<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">&lt;?php<br /><br />class yubilala {<br /><br />  var $hash; var $time; var $stat;<br /><br />  function set($a,$b,$c)<br />  {   <br />      $this-&gt;hash=$a; $this-&gt;time=$b; $this-&gt;stat=$c;<br />  }<br /><br />  function yubi_verify($url,$port,$timeout,$id,$otp)<br />  {<br />    $fp = fsockopen($url, $port, $errno, $errstr, $timeout);<br />    if (!$fp) {<br />      $this-&gt;set(&quot;&quot;,&quot;&quot;,&quot;$errstr ($errno)&quot;);<br />    }<br />    fputs($fp, &quot;GET /wsapi/verify?id=&quot; . $id . &quot;&amp;otp=&quot; . $otp . &quot;\r\n&quot;);<br />    fputs($fp, &quot;\r\n&quot;);<br />    fflush($fp);<br /><br />    $buf = '';<br />    while (!feof($fp)) {<br />      $buf .= fgets($fp, 128);<br />    }<br />    fclose($fp);<br />    if (ereg(&quot;^h=(&#91;^ &#93;*).*t=(&#91;^ &#93;*).*status=(&#91;^ &#93;*).*&quot;, $buf, $reg) ) {;<br />      $this-&gt;set( trim($reg&#91;1&#93;),trim($reg&#91;2&#93;),trim($reg&#91;3&#93;));<br />    } else {<br />      $this-&gt;set(&quot;&quot;,&quot;&quot;,'Invalid response from server ' . $url);<br />    }<br />  }<br />}<br /><br /><br />/** USAGE **/<br /><br />$r=new yubilala();<br /><br />// the $otp variable is filled with the output of a yubikey<br />//<br />$otp='vvvvvvvvvvvvthktlegjijctflkkklbiggrjrntrehlr';<br /><br />// acquire your own userid and set its value here:<br />//<br />$id='4711';<br /><br />$r-&gt;yubi_verify(&quot;api.yubico.com&quot;, 80, 5, $id, $otp);<br /><br />echo &quot;Result: &quot; . $r-&gt;stat;<br /><br />?&gt;<br /><br /></div><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=682">fortean</a> — Fri Jun 26, 2009 7:12 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[fortean]]></name></author>
<updated>2009-06-26T11:32:57+01:00</updated>
<published>2009-06-26T11:32:57+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1523#p1523</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1523#p1523"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1523#p1523"><![CDATA[
<div class="quotetitle">ramonsky wrote:</div><div class="quotecontent"><br />I'm interested in this topic too, as I'm a web developer. <br /><br />I've read the documentation, but I'm still confused. I don't get all those extra parameters.<br /><br />All I want to be able to do is ask the user for ONE parameter (the OTP), pass it to the API, and get back the answer &quot;Yes&quot; or &quot;No&quot;. How do I do that? (I'm happy to rely on Yubico's servers, and I don't want to reflash my Yubikey).<br /></div><br /><br />You'll need to require an API id first. There is a webpage (<a href="https://api.yubico.com/yms/getapi.php" class="postlink">https://api.yubico.com/yms/getapi.php</a>) to do that. You are then assigned a unique ID and an API key. Then, you (preferably your application <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /> ) can do some GET actions to the Yubicom validation webserver, using your ID and the token received from the other party. The server will validate and return the 'Yes' or 'No' you required (albeit in another format than a strict 'yes' or 'no').<br /><br />The process has been decribed quite nicely here: <a href="http://yubico.com/developers/api/" class="postlink">http://yubico.com/developers/api/</a>. Hope it helps.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=682">fortean</a> — Fri Jun 26, 2009 11:32 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ramonsky]]></name></author>
<updated>2009-06-25T22:51:50+01:00</updated>
<published>2009-06-25T22:51:50+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1521#p1521</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1521#p1521"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1521#p1521"><![CDATA[
I'm interested in this topic too, as I'm a web developer. <br /><br />I've read the documentation, but I'm still confused. I don't get all those extra parameters.<br /><br />All I want to be able to do is ask the user for ONE parameter (the OTP), pass it to the API, and get back the answer &quot;Yes&quot; or &quot;No&quot;. How do I do that? (I'm happy to rely on Yubico's servers, and I don't want to reflash my Yubikey).<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=378">ramonsky</a> — Thu Jun 25, 2009 10:51 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[network-marvels]]></name></author>
<updated>2009-06-09T10:17:11+01:00</updated>
<published>2009-06-09T10:17:11+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1496#p1496</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1496#p1496"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1496#p1496"><![CDATA[
Please use the following Google code link which points to installation documents for &quot;YKKSM&quot; project:<br /><br /><!-- m --><a class="postlink" href="http://code.google.com/p/yubikey-ksm/w/list">http://code.google.com/p/yubikey-ksm/w/list</a><!-- m --><br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$key = ModHex::Decode(&quot;urtubjtnuihvntcreeeecvbregfjibtn&quot;);// what is the string for ? where i can get this ?<br /></div> <br />This is the ModHex encoded AES Key of the YubiKey. As a YubiKey is write-only device, you can not read the AES key stored in the YubiKey. You need to reprogram your YubiKey with the desired AES key using the Yubico Personalization tool and then store it in the &quot;YKKSM&quot; database. For more information about reprogramming your YubiKey, please visit the following link, which provides download links for Yubico Personalization tool and user guide:<br /><br /><!-- m --><a class="postlink" href="http://www.yubico.com/developers/personalization/">http://www.yubico.com/developers/personalization/</a><!-- m --><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=280">network-marvels</a> — Tue Jun 09, 2009 10:17 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Yuvaraj]]></name></author>
<updated>2009-06-09T07:55:35+01:00</updated>
<published>2009-06-09T07:55:35+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1495#p1495</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1495#p1495"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1495#p1495"><![CDATA[
Hi<br /><br /> Thanks for your reply . i went to that link but it is looping again and again to the same page. how to install yubikey-ksm in windows and linux servers. <br />i had downloaded the code in the net . <br /><br /><br />require_once(&quot;yubikey.php&quot;);<br /> $key = ModHex::Decode(&quot;<span style="color: #FF0000">urtubjtnuihvntcreeeecvbregfjibtn</span>&quot;);//<span style="color: #FF0000"> what is the string for  ? where i can get this ?</span><br /> $token = &quot;dteffujedcflcindvdbrblehecuitvjkjevvehjd&quot;; // Using yubico i got token<br /> <br /> $decoded_token = Yubikey::Decode($token, $key);<br /><br /> if ( ! is_array($decoded_token) ) { <br />  die( &quot;DECODING FAILED, $decoded_token\n&quot;);<br /> }<br /> else {<br />  // Uncomment to see contents of the decoded array.<br />  // print_r($decoded_token);<br /> }.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=672">Yuvaraj</a> — Tue Jun 09, 2009 7:55 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[network-marvels]]></name></author>
<updated>2009-06-08T14:09:05+01:00</updated>
<published>2009-06-08T14:09:05+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1492#p1492</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1492#p1492"/>
<title type="html"><![CDATA[Re: Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1492#p1492"><![CDATA[
Please visit the following Google code link which provides the PHP class for YubiKey OTP based authentication:<br /><br /><!-- m --><a class="postlink" href="http://code.google.com/p/php-yubico/">http://code.google.com/p/php-yubico/</a><!-- m --><br /><br />You can integrate this class to your existing login system to provide YubiKey OTP based authentication. <br /><br />To provide offline OTP validation service, you can host your own OTP validation server in your local environment. For more information about the OTP validation server, please visit the following link:<br /><br /><!-- m --><a class="postlink" href="http://www.yubico.com/developers/srv/">http://www.yubico.com/developers/srv/</a><!-- m --><br /><br />We hope this helps !<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=280">network-marvels</a> — Mon Jun 08, 2009 2:09 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Yuvaraj]]></name></author>
<updated>2009-06-08T12:27:32+01:00</updated>
<published>2009-06-08T12:27:32+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=333&amp;p=1490#p1490</id>
<link href="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1490#p1490"/>
<title type="html"><![CDATA[Intergration of Yubico with PHP]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=333&amp;p=1490#p1490"><![CDATA[
Hi,<br /><br /> Im New to this yubico , and we are trying to intergrate this with our Login page. can any body help me on how to integrate  youbico with PHP. how to use this in offline  because some of our client have no internet connection. <br /><br />Thanks in Advance<br />Yuvaraj<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=672">Yuvaraj</a> — Mon Jun 08, 2009 12:27 pm</p><hr />
]]></content>
</entry>
</feed>