A compilation of documentation   { en , fr }

How to decrypt a file with GnuPG

Created on:
Xavier Béguin

Example of a decryption command

The following commands are equivalent: they will decrypt the file importantfile.txt.gpg and write the resulting information to the file importantfile.txt (the encrypted file is not deleted):

gpg --decrypt importantfile.txt.gpg --output importantfile.txt
gpg -d importantfile.txt.gpg > importantfile.txt

This command is the same for files encrypted using symmetric or asymmetric encryption:

  • with symmetric encryption, you must be able to input the passphrase that was used to encrypt the file. By default, a graphical dialog window will ask you to input the passphrase;
  • with asymmetric encryption, the secret key corresponding to the public key the file was originally encrypted with must be present in your primary secret keyring.