How restore backuped /.gnupg/private-keys-v1.d

Werner Koch wk at
Fri Dec 9 21:06:40 CET 2016

On Fri,  9 Dec 2016 16:03, ondrejstrestik at said:

> i have reall big problem because i accydently deleted /.gnupg, but still i have backuped /.gnupg/private-keys-v1.d so i have 4 “hashfile" name files with suffix .key

That good.  Run gpg once to create a new .gnupg directory (or create it
manually).  Then copy the four files to the new private-keys-v1.d
directory and you have restored the secret key material.  Now you need
to get a copy of your two (I guess) public keys.  They should be on the
keyservers or you have send them to other places, get a copy and gpg
--import them.  Better restart the gpg-agent (gpgconf --kill gpg-agent).
That's it.

If you can't find the public keys, there is no real damage because the
nobody sent you encrypted data or nobody else cared to verify your data.

> - i thought i will copy private-keys-v1.d back to the ./gnupg and everything will be ok (like ssh)

Partly.  All the secrets are restored as I explained above.

> Now i am i situation where i can not import “raw” keys and everytime
> when i try to import private key i will get message like: No valid

What do you mean by raw key?  You are looking for files created with

  gpg --export


  gpg --export --armor

or with any other OpenPGP tool.  You can implement such files with 

  gpg --import

Take care that they are not encrypted (some people do this) and that
they are not gzipped etc.  Using the extra option -v is always a good
idea in such cases.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: </pipermail/attachments/20161209/c132ac4e/attachment.sig>

More information about the Gnupg-users mailing list