tag:gpgtools.tenderapp.com,2011-11-04:/discussions/problems/57458-extracting-private-key-from-a-smartcardGPGTools: Discussion 2018-02-16T12:13:04Ztag:gpgtools.tenderapp.com,2011-11-04:Comment/433462842017-09-02T10:14:10Z2017-09-02T10:14:11ZExtracting private key from a smartcard<div><p>Hi there,</p>
<p>I just moved my primary key and its subkeys to a smartcard. Command-line GPG clearly shows (adds '>' after 'sec' and 'ssb' in the list of secret keys) that all of the keys are now on the card. However, using both the command line and the GPG Keychain GUI I can still export both public AND private keys, when the card is present AND when the card is removed. Evidently, I still have the secret keys on the keyring on my machine. Am I doing something wrong? I am running GnuPG/MacGPG2 2.0.30 on macOS 10.12.6.</p>
<p>Thank you for any feedback!</p></div>Dennistag:gpgtools.tenderapp.com,2011-11-04:Comment/433462842017-09-11T09:29:04Z2017-09-11T09:34:22ZExtracting private key from a smartcard<div><p>Hi Dennis,</p>
<p>it looks like, you have copied the keys to the smart card, but not deleted it from your local machine.<br>
To solve this:<br>
1. Make a backup of your .gnupg folder.<br>
2. Delete your secret key using GPG Keychain. (Do NOT delete the public key!)<br>
3. Plug in your smart card.<br>
4. On the command-line run <code>gpg --card-status</code>.</p>
<p>Now everything should be working as expected.</p>
<p>Regards, Mento</p></div>Mentotag:gpgtools.tenderapp.com,2011-11-04:Comment/433462842017-09-11T13:43:25Z2017-09-11T13:43:26ZExtracting private key from a smartcard<div><p>Hi Mento,</p>
<p>Thank you for the walk-through. In fact, I did just that: deleted the entire key through the GPG Keychain (including the public key, to be on the safe side), then re-imported the public key only, and finally paired the imported public key with the card-based private key via "gpg --card-status". At which point I was again able to export the entire key (public + private keys) through GPG Keychain. Clearly the private key remains somewhere on the chain (even though not visible through GUI). Will try deleting private key only and will report back.</p>
<p>Best,</p>
<p>Dennis</p></div>Dennistag:gpgtools.tenderapp.com,2011-11-04:Comment/433462842018-02-16T12:13:03Z2018-02-16T12:13:03ZExtracting private key from a smartcard<div><p>Closing, since no further user feedback was received. Should your problem persist, feel free to re-open this discussion any time.</p>
<p>All the best, steve</p></div>Steve