I have a file I'm needing to decrypt, but my operating system was reinstalled and I don't remember which software I should use to decrypt it. Fortunately, the data is still preserved, including what I believe to be the private key. I'm referring to something I've found that is stored in the ~/.gnupg directory, but as I said I only believe this to contain the PK. I'm not entirely sure if it works to decrypt the file.

Is there a way I can figure out which software and with which key should be used to decrypt the file? I was thinking about seahorse application, but I'm not sure.

I'm using ubuntu 18.10

Below I've listed everything under the .gnupg/ directory.


  • openpgp-revocs.d/
  • private-keys-v1.d/


  • pubring.kbx
  • random_seed
  • trustdb.gpg

3 Answers 3


Gnu Privacy Guard (gpg, the program that uses the ~/.gnupg directory) is encryption / signing software that implements the OpenPGP standard (originally, it was simply an open-source, patent-free clone of the "Pretty Good Privacy" program, which uses the file extension .pgp by default). gpg is a command-line program, though there exist GUI wrappers for it.

At least on Ubuntu 16.04, the package containing gpg is called "gnupg", so if running gpg <yourfile.pgp> in a terminal (such as gnome-terminal or xterm) doesn't do anything, try running sudo apt update && sudo apt install gnupg first. Passing an encrypted file to the gpg program will automatically result in attempting to decrypt the file. You will need the private key that the file was encrypted for, and GnuGP will need to know where to find it (by default, it will look in ~/.gnupg). You will also need the password for that private key (unless it was created without any password); gpg will prompt you to enter the password for your key file. If the command succeeds, gpg <yourfile.pgp> will produce a decrypted version of the file, with the .pgp extension stripped off.


As you want a *nix GUI software to decrypt a file encrypted using PGP format you are probably looking for kleopatra, which is probably in the software repositories.

You could use a different program or interface, though. If you restored ~/.gnupg (and you were previously able to decrypt it with those keys), it should still work in the new install (you will need to remember the key passphrase, too).


actually there is seahorse application that works on Nautilus Ubuntu file manager to do the encryption. After I installed seahorse-nautilus, I copy my old .gnupg directory into my new home folder, and it successfully decrypt the file using the key.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.