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

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2016-09-02T15:49:09+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=4&amp;t=2405</id>
<entry>
<author><name><![CDATA[SporkWitch]]></name></author>
<updated>2016-09-02T15:49:09+01:00</updated>
<published>2016-09-02T15:49:09+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8945#p8945</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8945#p8945"/>
<title type="html"><![CDATA[Re: [SOLVED] - how to transition to a new OpenPGP key (reset]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8945#p8945"><![CDATA[
<div class="quotetitle">mouse008 wrote:</div><div class="quotecontent"><br />Thank you! Cloned that repo, and got it to work on my Mac. I must say that (a) it doesn't work with Python2 any more - only Python3, and (b) it required some minor hacking to port it from Linux to Mac. I would need to add conditions to make it running on both Mac and Linux. Here's a sample:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$ ./token-rng.py <br />Set PKCS11_LIBRARY to &quot;/Library/OpenSC/lib/opensc-pkcs11.so&quot;<br /><br />INFO 2016-09-02 00:56:25,705 - token-rng - run_loop: TokenRNG initializing at Fri Sep  2 00:56:25 2016<br />INFO 2016-09-02 00:56:29,883 - token-rng - run_loop: Random data length: 128 bytes, hex value: b'fe866aa513280bb895dbb0eeaa6ea6194448d631d2d32966f8d6fadc902570e6c784d7a731f5325de5f7fe9716bf328d22e3165fc65c49b227b50761e5fc6e955ccec0271809bf08e8676bc70162e10ada23bf3757eb3815fb843a42543e29c6b7cfa8b1bad0ab0f4e55ab4ea216bc98a403057ce66536ccd1e69f60420bbd24'<br />INFO 2016-09-02 00:56:30,171 - token-rng - run_loop: Random data length: 128 bytes, hex value: b'f21d9a8247c3832f3dea6d39d083504775dc3d81099674ea2503db97b47d1740f79d1521733fc60551e218ca794a656406be05a52cce4168fd61122ee3b21629f4f2bc4f346a06428d54986bee36fd8b523c751360618aa760412ff321e71b512e45b0e78c62b9207c8a4fab4dbb777390b7272ad7a85cf3189d2aff856d76bf'<br /></div><br /><br />I must add that I don't quite understand how token-rng.py was supposed to be used.<br /></div><br />Yes, it's Python3-only now.  More things are moving that way as well, I just brought this up to it (because the 2.7 versions of some of the dependencies are no longer in the repos, only python3 versions).  If you modify it to work sanely on both mac and linux, submit a pull request, the original creator accepted my patch same day (was fairly simple fix, so wasn't much to review).  Feel free to email me if you want me to test your fork on linux to make sure that didn't break in the process.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4454">SporkWitch</a> — Fri Sep 02, 2016 3:49 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mouse008]]></name></author>
<updated>2016-09-02T06:00:06+01:00</updated>
<published>2016-09-02T06:00:06+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8944#p8944</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8944#p8944"/>
<title type="html"><![CDATA[Re: [SOLVED] - how to transition to a new OpenPGP key (reset]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8944#p8944"><![CDATA[
Thank you! Cloned that repo, and got it to work on my Mac. I must say that (a) it doesn't work with Python2 any more - only Python3, and (b) it required some minor hacking to port it from Linux to Mac. I would need to add conditions to make it running on both Mac and Linux. Here's a sample:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$ ./token-rng.py <br />Set PKCS11_LIBRARY to &quot;/Library/OpenSC/lib/opensc-pkcs11.so&quot;<br /><br />INFO 2016-09-02 00:56:25,705 - token-rng - run_loop: TokenRNG initializing at Fri Sep  2 00:56:25 2016<br />INFO 2016-09-02 00:56:29,883 - token-rng - run_loop: Random data length: 128 bytes, hex value: b'fe866aa513280bb895dbb0eeaa6ea6194448d631d2d32966f8d6fadc902570e6c784d7a731f5325de5f7fe9716bf328d22e3165fc65c49b227b50761e5fc6e955ccec0271809bf08e8676bc70162e10ada23bf3757eb3815fb843a42543e29c6b7cfa8b1bad0ab0f4e55ab4ea216bc98a403057ce66536ccd1e69f60420bbd24'<br />INFO 2016-09-02 00:56:30,171 - token-rng - run_loop: Random data length: 128 bytes, hex value: b'f21d9a8247c3832f3dea6d39d083504775dc3d81099674ea2503db97b47d1740f79d1521733fc60551e218ca794a656406be05a52cce4168fd61122ee3b21629f4f2bc4f346a06428d54986bee36fd8b523c751360618aa760412ff321e71b512e45b0e78c62b9207c8a4fab4dbb777390b7272ad7a85cf3189d2aff856d76bf'<br /></div><br /><br />I must add that I don't quite understand how token-rng.py was supposed to be used.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4029">mouse008</a> — Fri Sep 02, 2016 6:00 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SporkWitch]]></name></author>
<updated>2016-09-02T04:48:13+01:00</updated>
<published>2016-09-02T04:48:13+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8941#p8941</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8941#p8941"/>
<title type="html"><![CDATA[Re: [SOLVED] - how to transition to a new OpenPGP key (reset]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8941#p8941"><![CDATA[
<div class="quotetitle">mouse008 wrote:</div><div class="quotecontent"><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent">As far as the RNG, it should also be possible to use the TRNG (at least I assume it's a TRNG and not a PRNG) on the yubikey itself to generate entropy for your system. I've not tried getting it to work yet with my yubikey NEO, but I did manage to patch TokenTools to work on current ubuntu(-derivatives) and it works great using an old Feitian card I had laying around...<br /></div><br />I assume you're using OpenPGP applet? What's the command(s) (APDU) to request/retrieve random data from a token (say, NEO, or Feitan)?<br /><br />Can you do the same with PIV applet? What would the command be for it?<br /><br />P.S. On an Intel computer I'm using RDRAND (PRNG seeded and re-seeded by TRNG). But it would be nice to mix the YubiKey-generated random data in.</div><br />It uses uses opensc and pcscd to access a PKCS11-compliant card, repeatedly call for 128 bytes of random, and pipe it into the kernel's entropy pool.  That's why I'm not sure if it'll behave with the yubikey, as it was specifically designed for dedicated PKCS11 cards, such as the Feitian FTCOS/PK-01c I used when I was writing the patch for TokenTools.  I've not done any testing with the Yubikey, so I don't even have a baseline to go from.  It's on my to-do list, I just haven't gotten around to attacking it yet.<br /><br />More info on it can be found [url=https://github.com/infincia/TokenTools]here[/here].  I'm not the original author, I just patched it to get it running on current systems (the deps it used in the past no longer have python2.7 versions in the repos, so updated it to use python3 to allow installing the deps from the default repos).<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4454">SporkWitch</a> — Fri Sep 02, 2016 4:48 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mouse008]]></name></author>
<updated>2016-09-02T03:48:19+01:00</updated>
<published>2016-09-02T03:48:19+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8938#p8938</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8938#p8938"/>
<title type="html"><![CDATA[Re: [SOLVED] - how to transition to a new OpenPGP key (reset]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8938#p8938"><![CDATA[
<div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />As far as the RNG, it should also be possible to use the TRNG (at least I assume it's a TRNG and not a PRNG) on the yubikey itself to generate entropy for your system. I've not tried getting it to work yet with my yubikey NEO, but I did manage to patch TokenTools to work on current ubuntu(-derivatives) and it works great using an old Feitian card I had laying around...<br /></div><br />I assume you're using OpenPGP applet? What's the command(s) (APDU) to request/retrieve random data from a token (say, NEO, or Feitan)?<br /><br />Can you do the same with PIV applet? What would the command be for it?<br /><br />P.S. On an Intel computer I'm using RDRAND (PRNG seeded and re-seeded by TRNG). But it would be nice to mix the YubiKey-generated random data in.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4029">mouse008</a> — Fri Sep 02, 2016 3:48 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SporkWitch]]></name></author>
<updated>2016-08-30T10:00:22+01:00</updated>
<published>2016-08-30T10:00:22+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8924#p8924</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8924#p8924"/>
<title type="html"><![CDATA[Re: [question] - how to transition to a new OpenPGP key (res]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8924#p8924"><![CDATA[
<div class="quotetitle">linsam wrote:</div><div class="quotecontent"><br />Thank you for the detailed procedure! I think one minor correction is to hold off on doing the reset on the yubikey until just before transferring the new keys to the yubikey (else I won't be able to revoke or add a revoker or do the cross signing on the old key).  I've added a warning, though, just to be clear <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><br /><br />I had originally generated my keys within the yubikey and not my computer on the grounds that doing so would be more secure (both from the standpoint of not needing an air-gapped system for protection and also better RNG on the key). I see now that it is a huge tradeoff against the risk of loss and inconvenience of migrating. I also just discovered the DRNG on my CPU as a better entropy source for my PC, so that worry is also reduced.<br /><br />I'm definitely using your method now.<br /></div><br />Well the sequence was more a response to your original query, you said you locked it out, so you needed to reset it before you could do anything else on the yubikey itself anyway.<br /><br />As far as the RNG, it should also be possible to use the TRNG (at least I assume it's a TRNG and not a PRNG) on the yubikey itself to generate entropy for your system.  I've not tried getting it to work yet with my yubikey NEO, but I did manage to patch <a href="https://github.com/infincia/TokenTools" class="postlink">TokenTools</a> to work on current ubuntu(-derivatives) and it works great using an old Feitian card I had laying around.  As best I can tell from the NIST suite and dieharder, the randomness generated is of very good quality, too (though it's possible I'm not using the NIST suite quite right; it's not the most user-friendly of tools, but it's a beast at its job).<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4454">SporkWitch</a> — Tue Aug 30, 2016 10:00 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[linsam]]></name></author>
<updated>2016-08-30T06:40:59+01:00</updated>
<published>2016-08-30T06:40:59+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8922#p8922</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8922#p8922"/>
<title type="html"><![CDATA[Re: [question] - how to transition to a new OpenPGP key (res]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8922#p8922"><![CDATA[
Thank you for the detailed procedure! I think one minor correction is to hold off on doing the reset on the yubikey until just before transferring the new keys to the yubikey (else I won't be able to revoke or add a revoker or do the cross signing on the old key).<br /><br />I had originally generated my keys within the yubikey and not my computer on the grounds that doing so would be more secure (both from the standpoint of not needing an air-gapped system for protection and also better RNG on the key). I see now that it is a huge tradeoff against the risk of loss and inconvenience of migrating. I also just discovered the DRNG on my CPU as a better entropy source for my PC, so that worry is also reduced.<br /><br />I'm definitely using your method now.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4452">linsam</a> — Tue Aug 30, 2016 6:40 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SporkWitch]]></name></author>
<updated>2016-08-28T02:55:27+01:00</updated>
<published>2016-08-28T02:55:27+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8917#p8917</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8917#p8917"/>
<title type="html"><![CDATA[Re: [question] - how to transition to a new OpenPGP key (res]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8917#p8917"><![CDATA[
<div class="quotetitle">ChrisHalos wrote:</div><div class="quotecontent"><br />Only one tiny correction - with the YubiKey 4 you never have to run &quot;gpg-connect-agent --hex &quot;scd apdu 00 f1 00 00&quot; /bye&quot; - this is only needed for older NEOs to make sure you have version 1.0.6 or newer of the applet, so we're talking anything summer 2014 and newer isn't relevant (Unless you have a NEO applet older than 1.0.10, of course, which would be affected by the vulnerability, but it still isn't applicable for the discussion of resetting the applet). Since the YK4 was released in late 2015, this doesn't need to be run (and in fact, if you've locked out the card this will usually result in an error anyway which just confuses the user, thinking there is something else wrong).<br /><br />Otherwise, thanks for adding your thoughts here, very well-informed post <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><br /></div><br />Note added <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><br /><br />Just trying to help out where I can.  Someone I was helping on Freenode IRC was kind enough to donate a NEO he said he hadn't used to me as thanks, so I've been playing with it and seeing what I can't get out of it.  Looking forward to picking up a fresh one as a spare (and not wipe out the cc-prefix slot like an idiot...) once I have some spare cash, heh.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4454">SporkWitch</a> — Sun Aug 28, 2016 2:55 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ChrisHalos]]></name></author>
<updated>2016-08-27T21:17:03+01:00</updated>
<published>2016-08-27T21:17:03+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8915#p8915</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8915#p8915"/>
<title type="html"><![CDATA[Re: [question] - how to transition to a new OpenPGP key (res]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8915#p8915"><![CDATA[
Only one tiny correction - with the YubiKey 4 you never have to run &quot;gpg-connect-agent --hex &quot;scd apdu 00 f1 00 00&quot; /bye&quot; - this is only needed for older NEOs to make sure you have version 1.0.6 or newer of the applet, so we're talking anything summer 2014 and newer isn't relevant (Unless you have a NEO applet older than 1.0.10, of course, which would be affected by the vulnerability, but it still isn't applicable for the discussion of resetting the applet). Since the YK4 was released in late 2015, this doesn't need to be run (and in fact, if you've locked out the card this will usually result in an error anyway which just confuses the user, thinking there is something else wrong).<br /><br />Otherwise, thanks for adding your thoughts here, very well-informed post <img src="https://forum.yubico.com/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" /><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=3140">ChrisHalos</a> — Sat Aug 27, 2016 9:17 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SporkWitch]]></name></author>
<updated>2016-08-27T20:27:45+01:00</updated>
<published>2016-08-27T20:27:45+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8912#p8912</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8912#p8912"/>
<title type="html"><![CDATA[Re: [question] - how to transition to a new OpenPGP key (res]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8912#p8912"><![CDATA[
Oh, and sorry, as you noted you're basically SOL re: locking out the old one unless you made a backup like I recommended above.  All you can do at that point is contact everyone you use PGP with and inform them out-of-band about the transition.  I also can't stress enough the importance of securing that backup of the master key; I wasn't joking about an encrypted flash drive (even though the key's already encrypted) and a physical safe.  Your master key is arguably the equivalent of your digital passport, it is your identity online, and those signatures you gather over the years are invaluable.  As long as the master key is safe, so is that signature history.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4454">SporkWitch</a> — Sat Aug 27, 2016 8:27 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SporkWitch]]></name></author>
<updated>2016-08-30T10:17:23+01:00</updated>
<published>2016-08-27T20:21:01+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8911#p8911</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8911#p8911"/>
<title type="html"><![CDATA[Re: [question] - how to transition to a new OpenPGP key (res]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8911#p8911"><![CDATA[
<div class="quotetitle">linsam wrote:</div><div class="quotecontent"><br />I've been using a yubikey4 for some months now and just today decided to set the option to require a touch in addition to pin when signing or decrypting in gpg.<br /><br />Unfortunately, I forgot my admin pin and after 3 tries I am locked out of admin access for my key.<br /><br />As I understand it, I have to reset the OpenPGP app to recover, and doing so will wipe the private keys from the yubikey4.<br /><br />Also as far as I can tell, to transition from an old OpenPGP key to a new one, people generally cross sign the old and new keys, and write a key transition statement that is signed by both the old and new key. However, as near as I can tell, I cannot have both a new and old key on the yubikey4 at the same time[*], so I don't see how I can do cross signing nor the double signed transition statement.<br /><br />How can I update my key in an acceptable fashion?<br /><br />Some additional information: I did not create a backup when I generated the original key. I have not locked myself out of signing/decrypting with the old key yet (PW1 is still good, only the admin pin is at 0 attempts remaining)<br /></div><br /><strong>EDIT: Resetting the PGP applet will wipe out any keys currently stored.  This should only be performed if you cannot remember your PIN/PUK, or you've already had the applet locked out.</strong>  So, first things first, resetting the OpenPGP Applet (<a href="https://developers.yubico.com/ykneo-openpgp/ResetApplet.html" class="postlink">source</a>):<br /><ol style="list-style-type: decimal"><li>Check versions:<br />GPG &gt;= v2.0.22<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg2 --version</div><br /><strong>EDIT: this is only required on yubikeys prior to the YubiKey4: </strong>The below indicates v1.0.6; this is the minimum required.<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg-connect-agent --hex &quot;scd apdu 00 f1 00 00&quot; /bye<br />D&#91;0000&#93;  01 00 06 90 00</div></li><li>Reset the applet&#058;<br />Create a file and paste the following into it:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">/hex<br /> scd serialno<br /> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40<br /> scd apdu 00 e6 00 00<br /> scd apdu 00 44 00 00<br /> /echo Card has been successfully reset.</div><br />Now run it.<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg-connect-agent -r FILE</div></li></ol><br />So the way to deal with the transition is to generate the key on your computer and then move it to the yubikey.  In general, you should be doing this anyway, as otherwise you're unable to make a backup of the master key (this would mean that if the yubikey is lost or damaged, so is your master, and you have to start accumulating signatures from scratch).<br /><br />Generate your key on the computer.  Use 2048 bit keys or make sure you're using the versions listed in the link that follows.  Even though the yubikey4 supports 4096bit RSA, there's a problem in currently-shipped versions of libgcrypt that reduces the effective entropy and can cause the default encryption key to be mathematically related to the master key; this is a Bad Thing™ (<a href="https://lists.gnupg.org/pipermail/gnupg-announce/2016q3/000395.html" class="postlink">CVE-2016-6316</a>).  Once you've generated the key, open it and inspect:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg2 --edit-key --expert &lt;keyid&gt;</div><br />You should see your master key with &quot;Usage: SC&quot; and a key with &quot;Usage: E&quot;.  This is your master and your encryption key respectively.  The first thing you should do is generate a separate signing key:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg2 --edit-key robert@klebes.info <br />gpg (GnuPG) 2.1.11; Copyright (C) 2016 Free Software Foundation, Inc.<br />This is free software: you are free to change and redistribute it.<br />There is NO WARRANTY, to the extent permitted by law.<br /><br />Secret key is available.<br /><br />sec  rsa2048/0xC13607BD83A9E927<br />     created: 2016-08-25  expires: 2017-08-25  usage: SC  <br />     trust: ultimate      validity: ultimate<br />ssb  rsa2048/0x970B4C0FC47073FE<br />     created: 2016-08-25  expires: 2017-08-25  usage: E   <br />&#91;ultimate&#93; (1). Robert Klebes &lt;robert@klebes.info&gt;<br />&#91;ultimate&#93; (2)  Robert Klebes &lt;rob.klebes@gmail.com&gt;<br />&#91;ultimate&#93; (3)  Robert Klebes &lt;rfk3806@rit.edu&gt;<br />&#91;ultimate&#93; (4)  Robert Klebes (Keybase User: sporkwitch) &lt;sporkwitch@keybase.io&gt;<br /><br />gpg&gt; addkey<br />Secret parts of primary key are stored on-card.<br />Please select what kind of key you want:<br />   (3) DSA (sign only)<br />   (4) RSA (sign only)<br />   (5) Elgamal (encrypt only)<br />   (6) RSA (encrypt only)<br />   (7) DSA (set your own capabilities)<br />   (8) RSA (set your own capabilities)<br />  (10) ECC (sign only)<br />  (11) ECC (set your own capabilities)<br />  (12) ECC (encrypt only)<br />  (13) Existing key<br />Your selection? 4<br />RSA keys may be between 1024 and 4096 bits long.<br />What keysize do you want? (2048) 2048<br />Requested keysize is 2048 bits<br />Please specify how long the key should be valid.<br />         0 = key does not expire<br />      &lt;n&gt;  = key expires in n days<br />      &lt;n&gt;w = key expires in n weeks<br />      &lt;n&gt;m = key expires in n months<br />      &lt;n&gt;y = key expires in n years<br />Key is valid for? (0) 1y<br />Key expires at Sun 27 Aug 2017 14:49:19 EDT<br />Is this correct? (y/N) y<br />Really create? (y/N) y<br />We need to generate a lot of random bytes. It is a good idea to perform<br />some other action (type on the keyboard, move the mouse, utilize the<br />disks) during the prime generation; this gives the random number<br />generator a better chance to gain enough entropy.<br /><br />sec  rsa2048/0xC13607BD83A9E927<br />     created: 2016-08-25  expires: 2017-08-25  usage: SC  <br />     card-no: 0006 03647658<br />     trust: ultimate      validity: ultimate<br />ssb  rsa2048/0x970B4C0FC47073FE<br />     created: 2016-08-25  expires: 2017-08-25  usage: E   <br />ssb  rsa2048/0xAD5F52AC4DEB718E<br />     created: 2016-08-27  expires: 2017-08-27  usage: S   <br />&#91;ultimate&#93; (1). Robert Klebes &lt;robert@klebes.info&gt;<br />&#91;ultimate&#93; (2)  Robert Klebes &lt;rob.klebes@gmail.com&gt;<br />&#91;ultimate&#93; (3)  Robert Klebes &lt;rfk3806@rit.edu&gt;<br />&#91;ultimate&#93; (4)  Robert Klebes (Keybase User: sporkwitch) &lt;sporkwitch@keybase.io&gt;</div><br />And if you want an authentication key (authentication keys should be separate from signing keys, otherwise there's the possibility of a malicious system tricking you into signing something when you were meant to be authenticating):<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg&gt; addkey<br />Secret parts of primary key are stored on-card.<br />Please select what kind of key you want:<br />   (3) DSA (sign only)<br />   (4) RSA (sign only)<br />   (5) Elgamal (encrypt only)<br />   (6) RSA (encrypt only)<br />   (7) DSA (set your own capabilities)<br />   (8) RSA (set your own capabilities)<br />  (10) ECC (sign only)<br />  (11) ECC (set your own capabilities)<br />  (12) ECC (encrypt only)<br />  (13) Existing key<br />Your selection? 8<br /><br />Possible actions for a RSA key: Sign Encrypt Authenticate <br />Current allowed actions: Sign Encrypt <br /><br />   (S) Toggle the sign capability<br />   (E) Toggle the encrypt capability<br />   (A) Toggle the authenticate capability<br />   (Q) Finished<br /><br />Your selection? s<br /><br />Possible actions for a RSA key: Sign Encrypt Authenticate <br />Current allowed actions: Encrypt <br /><br />   (S) Toggle the sign capability<br />   (E) Toggle the encrypt capability<br />   (A) Toggle the authenticate capability<br />   (Q) Finished<br /><br />Your selection? e<br /><br />Possible actions for a RSA key: Sign Encrypt Authenticate <br />Current allowed actions: <br /><br />   (S) Toggle the sign capability<br />   (E) Toggle the encrypt capability<br />   (A) Toggle the authenticate capability<br />   (Q) Finished<br /><br />Your selection? a<br /><br />Possible actions for a RSA key: Sign Encrypt Authenticate <br />Current allowed actions: Authenticate <br /><br />   (S) Toggle the sign capability<br />   (E) Toggle the encrypt capability<br />   (A) Toggle the authenticate capability<br />   (Q) Finished<br /><br />Your selection? q<br />RSA keys may be between 1024 and 4096 bits long.<br />What keysize do you want? (2048) 2048<br />Requested keysize is 2048 bits<br />Please specify how long the key should be valid.<br />         0 = key does not expire<br />      &lt;n&gt;  = key expires in n days<br />      &lt;n&gt;w = key expires in n weeks<br />      &lt;n&gt;m = key expires in n months<br />      &lt;n&gt;y = key expires in n years<br />Key is valid for? (0) 1y<br />Key expires at Sun 27 Aug 2017 14:53:57 EDT<br />Is this correct? (y/N) y<br />Really create? (y/N) y<br />We need to generate a lot of random bytes. It is a good idea to perform<br />some other action (type on the keyboard, move the mouse, utilize the<br />disks) during the prime generation; this gives the random number<br />generator a better chance to gain enough entropy.<br /><br />sec  rsa2048/0xC13607BD83A9E927<br />     created: 2016-08-25  expires: 2017-08-25  usage: SC  <br />     card-no: 0006 03647658<br />     trust: ultimate      validity: ultimate<br />ssb  rsa2048/0x970B4C0FC47073FE<br />     created: 2016-08-25  expires: 2017-08-25  usage: E   <br />ssb  rsa2048/0xAD5F52AC4DEB718E<br />     created: 2016-08-27  expires: 2017-08-27  usage: S   <br />ssb  rsa2048/0xCD560758CC50C8A8<br />     created: 2016-08-27  expires: 2017-08-27  usage: A   <br />&#91;ultimate&#93; (1). Robert Klebes &lt;robert@klebes.info&gt;<br />&#91;ultimate&#93; (2)  Robert Klebes &lt;rob.klebes@gmail.com&gt;<br />&#91;ultimate&#93; (3)  Robert Klebes &lt;rfk3806@rit.edu&gt;<br />&#91;ultimate&#93; (4)  Robert Klebes (Keybase User: sporkwitch) &lt;sporkwitch@keybase.io&gt;</div><br /><br />Once this is done, you should now have a sane key setup in your machine's gpg keyring, as well as the old key still residing on your yubikey.  You can now use the old key to sign the new one in gpg as normal.  Once you've done this, you can then sign the old key with the new:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg2 -u &lt;newkeyid&gt; --edit-key &lt;oldkeyid&gt;</div><br /><br />Similarly, you can create a text document discussing the transition.  This should include (but is not limited to) the old keyid (with full fingerprint), the new keyid (with full fingerprint), and the date of supersession.  You can sign this statement with both keys via the -u flag to specify which key to use.<br /><br />Last steps.<br /><br />If this is your only copy of the old master key, you should revoke it now, and in the revocation statement you should include a supersession statement (include the date of supersession and the full fingerprint of the new key).  <strong>EDIT: if you have the master backed up somewhere, you should make the new key a revoker on it (edit the old key and use &quot;addrevoker&quot;), and hold off on revoking the old key for a short while after posting the supersession statement.  This helps keep it from looking as suspicious as an immediate creation -&gt; revocation would.</strong><br /><br />Before moving the new keys onto the yubikey, you should make a backup (<strong>EDIT: this should be kept somewhere safe, such as on an encrypted flash drive and stored <em>in</em> a safe)</strong>:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg2 --export-secret-keys --armour &lt;newkeyid&gt; &gt; privkey.bak.asc</div><br /><br />Next we want to get the master key off of this system:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">gpg2 --export-secret-subkeys &lt;newkeyid&gt; &gt; subkeys.asc<br />gpg2 --delete-secret-key &lt;newkeyid&gt;<br />gpg2 --import subkeys.asc<br />shred --remove subkeys.asc</div><br /><br />Check the key and you should now <em>only</em> see the Encryption, Signing, and (if you made one) Authentication subkeys.<br /><br />Finally, we can move the keys to the yubikey.  Simply open your new key for editing again and use the &quot;keytocard&quot; command to move the signing, encryption, and authentication keys to the yubikey.<br /><br />Congratulations, you're done!  You've now migrated to a new key and have a secure setup.  In the event your yubikey is lost, you still have a backup of the master key, and more importantly, the master key itself has not been compromised; you can simply revoke the keys on the yubikey and generate new ones, without losing the signatures others have placed on your key.<br /><br />I hope that helped :)<br /><br />[b]EDIT: Final note: only a key with the C(ertification) usage can be used to sign keys (including the signature required to extend the expiry or add new subkeys), and per RFC 4880, only the master key should be permitted to Certify.  This means that you will need to use the backup in order to perform those actions or sign other people's keys.  This is feasible because, in general, these activities are relatively rare.  A more secure setup would involve the use of a second token (such as yubikey) in which you store the master key, so that your master is not exposed when you need to use it (in theory it would take destructive methods and probably a SEM to extract the secret key from the secure module, and let's be honest, that means your adversary is a government, in which case they've got far more effective methods of getting you to turn it over, and you've got far bigger problems than losing your keys).<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4454">SporkWitch</a> — Sat Aug 27, 2016 8:21 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[linsam]]></name></author>
<updated>2016-08-30T06:42:31+01:00</updated>
<published>2016-08-26T05:10:18+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8908#p8908</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8908#p8908"/>
<title type="html"><![CDATA[[SOLVED] - how to transition to a new OpenPGP key (reset)]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2405&amp;p=8908#p8908"><![CDATA[
I've been using a yubikey4 for some months now and just today decided to set the option to require a touch in addition to pin when signing or decrypting in gpg.<br /><br />Unfortunately, I forgot my admin pin and after 3 tries I am locked out of admin access for my key.<br /><br />As I understand it, I have to reset the OpenPGP app to recover, and doing so will wipe the private keys from the yubikey4.<br /><br />Also as far as I can tell, to transition from an old OpenPGP key to a new one, people generally cross sign the old and new keys, and write a key transition statement that is signed by both the old and new key. However, as near as I can tell, I cannot have both a new and old key on the yubikey4 at the same time[*], so I don't see how I can do cross signing nor the double signed transition statement.<br /><br />How can I update my key in an acceptable fashion?<br /><br />Some additional information: I did not create a backup when I generated the original key. I have not locked myself out of signing/decrypting with the old key yet (PW1 is still good, only the admin pin is at 0 attempts remaining)<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4452">linsam</a> — Fri Aug 26, 2016 5:10 am</p><hr />
]]></content>
</entry>
</feed>