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

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2015-02-06T09:38:55+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=26&amp;t=1729</id>
<entry>
<author><name><![CDATA[Klas]]></name></author>
<updated>2015-02-06T09:38:55+01:00</updated>
<published>2015-02-06T09:38:55+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6835#p6835</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6835#p6835"/>
<title type="html"><![CDATA[Re: piv-tool cannot set management key]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6835#p6835"><![CDATA[
Hello,<br /><br />Adding parity enforcing in version 0.1.4 was not a very well considered change. We've changed it back to not enforcing parity and released 0.1.5 since.<br /><br />/klas<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2019">Klas</a> — Fri Feb 06, 2015 9:38 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[asym]]></name></author>
<updated>2015-02-03T08:02:19+01:00</updated>
<published>2015-02-03T08:02:19+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6796#p6796</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6796#p6796"/>
<title type="html"><![CDATA[Re: piv-tool cannot set management key]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6796#p6796"><![CDATA[
The following script should work. When I have some more time, I'll explain what it's doing but this should work if you need to get up and running on version 0.1.4. I had to invoke some serious bit black magic to get it working, but i've tested it several hundred times and all produced keys have succeeded. There's probably a far more elegant way to handle the character encoding than hex printf, but I needed to shotgun my way through it to get something viable working. <br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">NEW_MGM_KEY=<br />BYTE_COUNTER=0<br />until &#91; $BYTE_COUNTER == 24 &#93;; <br />do<br />   CURRENT_BYTE=`dd if=/dev/urandom bs=1 count=1 2&gt;/dev/null | hexdump -v -e '/1 &quot;%02x&quot;' | cut -c1-2`<br />   printf -v CURRENT_BYTE '%x' $((16#$CURRENT_BYTE | 16#01))<br />   printf -v TEMP_BYTE '%x' $((16#$CURRENT_BYTE ^ (16#$CURRENT_BYTE &gt;&gt; 4)))<br />   printf -v TEMP_BYTE '%x' $((16#$TEMP_BYTE &amp; 0x0f))   <br />   printf -v PARITY_BIT '%x' $(((0x6996&gt;&gt;16#$TEMP_BYTE) &amp; 0x01))<br />   printf -v PARITY_MASK '%x' $((0xfe | 16#$PARITY_BIT))<br />   printf -v FIXED_BYTE '%x' $((16#$CURRENT_BYTE &amp; 16#$PARITY_MASK))<br />   if &#91;&#91; ((16#$FIXED_BYTE -le 0xf)) &#93;&#93;;<br />   then<br />      NEW_BYTE=&quot;0$FIXED_BYTE&quot;<br />   else   <br />      NEW_BYTE=&quot;$FIXED_BYTE&quot;<br />   fi<br />   NEW_MGM_KEY=&quot;$NEW_MGM_KEY$NEW_BYTE&quot;<br />   let BYTE_COUNTER+=1<br />done<br />echo $NEW_MGM_KEY<br /></div><br />For your purposes, replace my echo command with something like:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">yubico-piv-tool -v -a set-mgm-key -n $NEW_MGM_KEY</div><br />Remember that this is a privileged operation, and the yubico-piv-tool is silently invoking the default key when -k &lt;current_key&gt; is not provided. If you want to change the key after you've changed it one or more times, you'll need to use:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">yubico-piv-tool -v -a set-mgm-key -n $NEW_MGM_KEY -k $CURRENT_MGM_KEY</div><br />-asym<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=3302">asym</a> — Tue Feb 03, 2015 8:02 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[nikki]]></name></author>
<updated>2015-02-02T17:07:10+01:00</updated>
<published>2015-02-02T17:07:10+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6790#p6790</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6790#p6790"/>
<title type="html"><![CDATA[piv-tool cannot set management key]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1729&amp;p=6790#p6790"><![CDATA[
Hi.<br /><br />I cannot set up set-mgm-key with piv-tool. I follow insructions from <!-- m --><a class="postlink" href="https://developers.yubico.com/yubico-piv-tool/Certificate_Authority_with_NEO.html">https://developers.yubico.com/yubico-pi ... h_NEO.html</a><!-- m --> (Preparing a Sub-CA NEO) and got the following error:<br />$ yubico-piv-tool -V<br />yubico-piv-tool 0.1.4<br /><br />$ key=`dd if=/dev/random bs=1 count=24 2&gt;/dev/null | hexdump -v -e '/1 &quot;%02X&quot;'`; echo $key;  yubico-piv-tool -a set-mgm-key -n $key -v 9<br />75AC965BECE5B3B60C623B1277224B47CC22522FCED8FD6E<br />using reader 'Yubico Yubikey NEO OTP+U2F+CCID' matching 'Yubikey'.<br />Authenticating since action 2 needs that.<br />Successful applet authentication.<br />Now processing for action 2.<br /><strong>Won't set new key '75 ac 96 5b ec e5 b3 b6 ' since it's got odd parity.<br />Failed setting the new key!</strong><br /><br />The Yubikey firmware version is 3.3.6 and PIV applet version is 0.1.2. And I'm using binary (precompiled) yubico-piv-tool for MacOS.<br /><br />Can you please explain how can I set the PIV applet's management key into fresh Yubikey NEO?<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2736">nikki</a> — Mon Feb 02, 2015 5:07 pm</p><hr />
]]></content>
</entry>
</feed>