gnupg/agent
James Bottomley 92b601fcee
gpg: Add new command keytotpm to convert a private key to TPM format
* agent/command.c (cmd_keytotpm): New.
(agent/command.c): Register new command KEYTOTPM.
* g10/call-agent.c (agent_keytotpm): New.
* g10/keyedit.c (cmdKEYTOTPM): New command "keytotpm".
(keyedit_menu): Implement.

--

The plumbing is done in two parts: the agent is modified to understand
a KEYTOTPM assuan command taking the key grip as an argument.  This
simply obtains the key s expression and calls the existing writeky
diversion to the tpm2daemon.  The daemon reponds with the TPM
conversion of the key and that key is then stored in the keyfile as a
shadowed-private-key with "tpm2-v1" type.

To effect the conversion, all the user does from gpg --edit-key is
select which private key they wish to move (or move the primary if no
key is selected) and type keytotpm.  The conversion to TPM form is
instantaneous and once converted, the actual key cannot be recovered,
meaning that if you want your gpg key to move to a new laptop you must
keep an unconverted backup copy in a safe location.

When you do a list command, all TPM keys show up as

     card-no: TPM-Protected

The key is stored encrypted to the TPM2 storage seed and since each
TPM has a unique seed, only the single TPM contained in your laptop
can now read the key.  This means you cannot simply copy the shadowed
key file over to a new laptop, you must copy over the backup copy and
then convert it to TPM form on the new laptop.

To decomission your laptop, execute a tssclear command which
regenerates the storage seed and effectively shreds all keys.  Note
when you have done this *every* TPM2 shadowed private key becomes
unreadable by any TPM and all are effectively destroyed.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Very minor cosmetic changes.

Signed-off-by: Werner Koch <wk@gnupg.org>
2021-03-10 13:34:18 +01:00
..
ChangeLog-2011 Fix typos 2015-10-28 10:20:17 +01:00
Makefile.am agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
agent.h agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
all-tests.scm tests: Make it possible to run all tests using our infrastructure. 2017-05-11 18:12:37 +02:00
cache.c agent: Fix SEGV when debuging for cache enabled. 2020-10-09 13:57:29 +09:00
call-daemon.c agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
call-pinentry.c po: Change translatability of a fallback string. 2021-02-18 14:43:43 +01:00
call-scd.c Fix the previous comment changes help doc string. 2020-11-20 17:17:30 +09:00
call-tpm2d.c agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
command-ssh.c agent: Support ssh-agent extensions for environment variables. 2021-01-25 10:35:06 +01:00
command.c gpg: Add new command keytotpm to convert a private key to TPM format 2021-03-10 13:34:18 +01:00
cvt-openpgp.c agent: Fix SOS handling with libgcrypt 1.8. 2020-11-09 11:04:22 +09:00
cvt-openpgp.h Change all http://www.gnu.org in license notices to https:// 2016-11-05 12:02:19 +01:00
divert-scd.c agent: Fix YK s/n and prettify the request card prompt for Yubikeys 2020-11-26 15:56:37 +01:00
divert-tpm2.c gpg: Add new command keytotpm to convert a private key to TPM format 2021-03-10 13:34:18 +01:00
findkey.c Replace all calls to access by gnupg_access 2020-10-20 12:15:55 +02:00
genkey.c agent: Allow to pass a timestamp to genkey and import. 2020-08-17 15:05:49 +02:00
gpg-agent-w32info.rc w32: Add icons and version information. 2013-05-07 21:35:48 +02:00
gpg-agent.c agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
keyformat.txt agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
learncard.c agent: Allow signing with card key even without a stub key. 2020-02-13 11:45:41 +01:00
pkdecrypt.c agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
pksign.c agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
preset-passphrase.c Use gpgrt's new option parser for the tools. 2020-02-21 20:28:47 +01:00
protect-tool.c w32: Replace some fopen by es_fopen. 2020-11-11 15:23:22 +01:00
protect.c agent: Add new shadow key type and functions to call tpm2daemon 2021-03-10 13:23:05 +01:00
sexp-secret.c gpg,agent: Support Ed448 signing. 2020-06-24 10:05:03 +09:00
t-protect.c build: Always use EXTERN_UNLESS_MAIN_MODULE pattern. 2020-02-10 16:50:47 +01:00
trans.c agent: Replace most assert by log_assert. 2019-05-14 10:31:46 +02:00
trustlist.c Replace all calls to access by gnupg_access 2020-10-20 12:15:55 +02:00
w32main.c Spelling cleanup. 2020-02-18 18:07:46 -05:00
w32main.h Change all http://www.gnu.org in license notices to https:// 2016-11-05 12:02:19 +01:00