0

When following instructions on how to import a GPG key to a TPM, I get the following error: gpg: error from TPM: Card error.

$ gpg --edit-key <key ID>
gpg (GnuPG) 2.4.5; Copyright (C) 2024 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

<key info>

gpg> keytotpm
Really move the primary key? (y/N) y
gpg: error from TPM: Card error

1 Answer 1

0

Check permissions on your TPM device: ls -la /dev/tpm*

$ ls -la /dev/tpm*
crw------- 1 root     root  10,   224 ліп  8 21:57 /dev/tpm0
crw------- 1 root root 249, 65536 ліп  8 21:57 /dev/tpmrm0

If it's owned by root like above, try to change owner to your current user: sudo chown $(whoami) /dev/tpmrm0

P.S.: You can see if TPM is working with Clevis. This command should return a JWE with no errors:

$ clevis encrypt tpm2 '{}' <<< 'hello, world'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .