0

I've created and symmetrically encrypted a file using GPG:

touch test.txt && echo 'test' >> test.txt
gpg --output test.txt --symmetric test.txt

But now I cannot figure out how to unencrypt it, and surprisingly, I cannot find an example online. Here's what I've tried:

$ gpg --decrypt test.txt
gpg: AES encrypted data
gpg: encrypted with 1 passphrase
$ gpg --symmetric --decrypt test.txt
gpg: conflicting commands
$ gpg --passphrase --decrypt test.txt
gpg: no valid OpenPGP data found.
gpg: decrypt_message failed: Unknown system error
$ gpg --decrypt --output test_decrypted.txt test.txt
gpg: no valid OpenPGP data found.
gpg: decrypt_message failed: Unknown system error

What am I doing wrong?

1

The correct command is

gpg --decrypt test.txt

but gpg overwrites its output before reading its input so your test.txt’s original contents were lost.

You need to encrypt to a different file:

gpg --output test.gpg --symmetric test.txt
|improve this answer|||||

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.