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

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2009-04-08T14:26:09+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=5&amp;t=308</id>
<entry>
<author><name><![CDATA[hakan]]></name></author>
<updated>2009-04-08T14:26:09+01:00</updated>
<published>2009-04-08T14:26:09+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=308&amp;p=1384#p1384</id>
<link href="https://forum.yubico.com/viewtopic.php?t=308&amp;p=1384#p1384"/>
<title type="html"><![CDATA[Quirks installing the yubikey-server-j release-1.1]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=308&amp;p=1384#p1384"><![CDATA[
I am guessing i am not the only one trying to get the validation server running and got stuck. <br />The setup guide is incomplete and it does not say what version it was written for, i am guessing for a version before the 1.1 release. <br />Anyhow, here are all the quirks i ran into when setting up the server.<br /><br />So i wanted to run my own validation server and use it with keys reprogrammed with the personalization tool (Yubico Configuration Utility). <br />The setup guide assumes you are requesting your keys from Yubico and (i assume) you get them b64-encoded, not modhex like in the configuration utility gives them to you.<br /><br />In my case i will be using the following key created by the configuration utility.<br /><br />Yuikey ID: 3e594965416c  <br />Yubikey AES Key: 3e787c4d5f77586d32363e314e537c53 <br />(This is the hex encoded output you get from the configuration utility)<br /><br />* Setting up the database<br /><br />In the documentation there is a section called &quot;Database Setup &amp; Table Relations&quot;. I imported the database from the db_schema.sql file. <br />The step that didnt quite work was when i needed to insert my key into the yubikey table. The example query did not work since the column names are wrong. <br />The guide assumes you already have your key in b65 format and the text is a bit confusing.<br />So how do i go from the format the configuration utility gives me to the format needed to insert my key?<br /><br />The guide talks briefly about this in section 6 but it is a bit confusing and the example did not work for me. I ended up doing a simple php script to solve the problem.<br />(Yes, some code is stolen from the yubico-php-lib project)<br /><br />&lt;?php<br /><br />function hex2bin($h)<br />{<br />  if (!is_string($h)) return null;<br />  $r='';<br />  for ($a=0; $a&lt;strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }<br />  return $r;<br />}<br /><br />// This data is what you get when running yubico configuration utility. These number are hex encoded. For example the result of using php:s bin2hex<br />$yubikeyId = &quot;3e594965416c&quot;;<br />$aesKey = &quot;3e787c4d5f77586d32363e314e537c53&quot;;<br /><br />echo &quot;Base 64 encoded tokenId: &quot; . base64_encode(hex2bin($yubikeyId)).&quot;\n&quot;;<br />echo &quot;Base 64 encoded AES KEY: &quot; . base64_encode(hex2bin($aesKey)).&quot;\n&quot;;<br /><br />?&gt;<br /><br />This gives us the following output:<br />Base 64 encoded tokenId: PllJZUFs<br />Base 64 encoded AES KEY: Pnh8TV93WG0yNj4xTlN8Uw==<br /><br />Now we have a working query to insert.<br />INSERT INTO `yubikeys` VALUES (1,1,1,'2007-10-03 16:11:50','2007-10-22 22:08:18','PllJZUFs','M2U3ODdjNGQ1Zjc3NTg2ZDMyMzYzZTMxNGU1MzdjNTM=',0,0,0,NULL)<br /><br />* Compiling the war file<br /><br />Check out the code and change the src/web.xml if you dont use the default password in the guide.<br />Compile using ant. (The chunk of text with warnings can be ignored)<br />Deploy the war file.<br /><br />Check your catalina.out for any errors. <br />If you start getting errors like &quot;java.io.CharConversionException&quot; like i did there are some things to check. <br />I actually got this error for several different reasons.<br /><br />First check your my.cnf, try adding the following.<br /><br />[client]<br />default-character-set=utf8<br />[mysqld]<br />default-character-set=utf8<br /><br />If it still does not work check what Java VM you are using.<br />I noticed that on my system &quot;gij (GNU libgcj) version 4.1.2 20070626 &quot; was installed by default and was giving me errors. <br />Works fine both with the ibm and sun version. Guess this can differ alot.<br /><br />* Validating a otp<br /><br />The server should be up and running and all should work fine, until you try to validate a OTP. The log will give you a sql exception that the column sessionUse does not exist. <br />Add it to the database: ALTER TABLE `yubikeys` ADD `sessionUse` INT( 11 ) NOT NULL AFTER `high` <br /><br /><br />Try it with: <!-- m --><a class="postlink" href="http://">http://</a><!-- m -->&lt;ip&gt;:8080/wsapi/verify?id=1&amp;otp=eugkfkhgfbhrugnukercncgtftkhkbvjcunddnggikef<br /><br />This installation was made on a 64 bit RHEL5 system.<br />This now runs together with radius, openvpn, ssh and all other crazy applications.<br /><br />Thats all, hope this can save someone some time.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=560">hakan</a> — Wed Apr 08, 2009 2:26 pm</p><hr />
]]></content>
</entry>
</feed>