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

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2009-04-13T10:42:07+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=16&amp;t=300</id>
<entry>
<author><name><![CDATA[firnsy]]></name></author>
<updated>2009-04-13T10:42:07+01:00</updated>
<published>2009-04-13T10:42:07+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=300&amp;p=1389#p1389</id>
<link href="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1389#p1389"/>
<title type="html"><![CDATA[Re: AES keys: ascii&lt;-&gt;hex]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1389#p1389"><![CDATA[
<div class="quotetitle">Greg Woods wrote:</div><div class="quotecontent"><br />Anybody got some code (or an algorithm that I can code) that will convert an AES key from encoded ASCII to hex? I need this as part of our project to integrate Yubikeys into an existing authentication infrastructure. We are using the YubiPAM module from freeradius to authenticate with Yubikeys, but I also want to be able to program the Yubikeys. This requires being able to enter the generated AES key into the database used by YubiPAM. However, the ykpasswd command used for YubiPAM wants the key in hex, whereas the ykpersonalize tool generates the key in encoded ASCII:<br /><br />key:gtheuknkdtkgjfufbvridkvetnlffukh<br /><br />I need a way to convert that to hex.<br /><br />Thanks,<br />--Greg<br /></div><br /><br />Greg,<br /><br />It may not be documented that well but ykpasswd will accept AES keys in either hex or modhex (or encoded ascii as you refer).<br /><br />firnsy<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=166">firnsy</a> — Mon Apr 13, 2009 10:42 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jakob]]></name></author>
<updated>2009-03-27T15:26:47+01:00</updated>
<published>2009-03-27T15:26:47+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=300&amp;p=1341#p1341</id>
<link href="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1341#p1341"/>
<title type="html"><![CDATA[Re: AES keys: ascii&lt;-&gt;hex]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1341#p1341"><![CDATA[
A C++ implementation could be done like... But there many ways to skin a cat...<br /><br />static const char trans[] = &quot;cbdefghijklnrtuv&quot;;<br /><br />void encode(char *dst, const unsigned char *src, int srcSize)<br />{<br />while (srcSize--) {<br />*dst++ = trans[*src &gt;&gt; 4];<br />*dst++ = trans[*src++ &amp; 0xf];<br />}<br /><br />*dst = '\0';<br />}<br /><br />void decode(unsigned char *dst, const char *src, int dstSize)<br />{<br />unsigned char b;<br />bool flag = false;<br />const char *p1;<br /><br />for (; *src, dstSize &gt; 0; src++) {<br />if ((p1 = strchr(trans, tolower(*src))) == NULL)<br />b = 0;<br />else<br />b = (BYTE) (p1 - trans);<br /><br />if (flag = !flag) <br />*dst = b;<br />else {<br />*dst = (*dst &lt;&lt; 4) | b;<br />dst++;<br />dstSize--;<br />}<br />}<br /><br />while (dstSize--) *dst++ = 0;<br />}<br /><br />Regards,<br /><br />JakobE<br />Hardware- and firmware guy @ Yubico<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=83">Jakob</a> — Fri Mar 27, 2009 3:26 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Dick]]></name></author>
<updated>2009-03-25T22:13:31+01:00</updated>
<published>2009-03-25T22:13:31+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=300&amp;p=1327#p1327</id>
<link href="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1327#p1327"/>
<title type="html"><![CDATA[Re: AES keys: ascii&lt;-&gt;hex]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1327#p1327"><![CDATA[
Is it hex to modhex and modhex to hex that you're after?  If so, I wrote a short program in AutoIT as a programming exercise that does that and would be happy to share the code.  Keep in mind that I'm not a pro at this so making fun of my code is strictly prohibited.  <img src="https://forum.yubico.com/images/smilies/icon_e_wink.gif" alt=";-)" title="Wink" /><br /><br />modhex: GTHEUKNKDTKGJFUFBVRIDKVETNLFFUKH<br />hex:      5D63E9B92D9584E41FC729F3DBA44E96<br /><br />Dick<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=359">Dick</a> — Wed Mar 25, 2009 10:13 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Greg Woods]]></name></author>
<updated>2009-03-25T16:25:08+01:00</updated>
<published>2009-03-25T16:25:08+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=300&amp;p=1325#p1325</id>
<link href="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1325#p1325"/>
<title type="html"><![CDATA[AES keys: ascii&lt;-&gt;hex]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=300&amp;p=1325#p1325"><![CDATA[
Anybody got some code (or an algorithm that I can code) that will convert an AES key from encoded ASCII to hex? I need this as part of our project to integrate Yubikeys into an existing authentication infrastructure. We are using the YubiPAM module from freeradius to authenticate with Yubikeys, but I also want to be able to program the Yubikeys. This requires being able to enter the generated AES key into the database used by YubiPAM. However, the ykpasswd command used for YubiPAM wants the key in hex, whereas the ykpersonalize tool generates the key in encoded ASCII:<br /><br />key:gtheuknkdtkgjfufbvridkvetnlffukh<br /><br />I need a way to convert that to hex.<br /><br />Thanks,<br />--Greg<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=356">Greg Woods</a> — Wed Mar 25, 2009 4:25 pm</p><hr />
]]></content>
</entry>
</feed>