Bad news: I forgot a GnuPG secret key passphrase.
Good news: I do know the words it is constructed of. So, I can easily use john
or similar to recover (too many combinations to do it manually, though).
Problem: The secret key is not in the secring.gpg
format that john
understands, but in some new format, apparently distributed across 2 files, in
~/.gnupg/private-keys-v1.d/0123456789ABCDEF0123456789ABCDEF01234567.key
and
~/.gnupg/private-keys-v1.d/123456789ABCDEF0123456789ABCDEF012345678.key
(files renamed for this question, obviously) created within the timespan of a few seconds - could be pubkey and seckey, if so which one is which?
Could someone please help, maybe by telling me how to extract the (still locked) seckey from these files without a passphrase? An ASCII armor format would be ideal.
Alternatively, maybe someone knows how to feed these files to john
directly?
On a related note: Can I enforce the secring.gpg
format in GnuPG
? I share /home
between systems with different versions of GnuPG
and don't want to duplicate key files.
Thanks.
PS: Since I already have files encrypted with the key a revocation and replacement would not be a viable solution.
gpg --list-packets 123.key
to see what's inside?gpg: no valid OpenPGP data found.
gpg
cannot understand these files, onlygpg-agent
(a daemon) can. Passphrases are read by a third, separate programpinentry
. Could it be more complicated?gpg
command doesn't understand the new private key database format, you need to usegpg2
command instead.gpg-agent
, how to usejohn
in a not yet supported way, and how to crack an encryption that wasn't designed to be) Cryptography would be the only other SE site better qualified to answer this. *I don't consider myself an authority, I'm just wildly speculating a possible solution.