You are not logged in.

#1 2023-12-21 14:52:24

publicimageltd
Member
Registered: 2023-11-13
Posts: 6

GNU PG setup messed up - is it possible to recover private keys?

Hi there,

I messed up my .gnupg directory, or at least I guess. I played around with stow and replaced the .gnupg with a symlink. Since then, gnupg does not list any keys anymore when I use one of these commands to list my keys:

gpg -K

or

gpg -k

I re-copied the directory to the original location, believing that gpg somehow does not like symlnks. But nothing changed. So the situation is:

  • I have a gnupg directory which looks alright (but I guess something is wrong)

  • It has the right permissions (700 for dirs, 600 for files) and ownerships

  • It has a subdirectoy "private-keys-v1.d" which contains several .key-files

  • the gpg command acts as if there are no keys stored at all, public nor private

I tried `gpg --import *.keys`, but it complains that these files are no valid OpenPGP data.

The problem is: One key is used as my "master key" which encrypts all the passwords using pass. And pass, of course, cannot access these keys neither. Ah yes, and did I mention that it also encrypts my backup?

Is it somehow possible to re-import the keys? After all, I do have the files.

Last edited by publicimageltd (2023-12-21 14:53:19)

Offline

#2 2023-12-22 14:24:22

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: GNU PG setup messed up - is it possible to recover private keys?

What about ~/.gnupg/{pub,sec}ring.gpg ?

strace -o /tmp/gpg.strace gpg -K

(don't post that, I'm not sure what'll be in it, but you could look at it, grep for ".gnupg" etc.)

Offline

#3 2023-12-22 15:14:42

publicimageltd
Member
Registered: 2023-11-13
Posts: 6

Re: GNU PG setup messed up - is it possible to recover private keys?

Good idea using strace. I solved the problem differently (finally found an old backup, to my relief), so I can't try it. But neither pubring.gog nor secring.gpg were present.

Is there a way to close this thread? It's not solved, and actually I think it is an interesting problem (I did not solve it, but circumvented it), but it does not make sense to leave it unspecific like that.

Offline

#4 2023-12-22 22:15:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: GNU PG setup messed up - is it possible to recover private keys?

But neither pubring.gpg nor secring.gpg were present.

They were at some point superseded by private-keys-v1.d and the .kbx, so it's not necessarily a problem (do they still exist in your backup?)

Offline

Board footer

Powered by FluxBB