I used gpg -c filename ... and when I double click on the file, it just decrypts it without asking for a password. I don't know, it feels like the file wasn't encrypted at all. What did I do wrong? Or how can I make sure the file is encrypted?

I see two options: either the file is encrypted but the key is in the cache OR it is just not encrypted at all.

2 Answers 2


Let's go through this step by step. First, we create a new "sensitive file" and encrypt it:

echo "Hello, World!" > hello.txt
gpg -c hello.txt                  # And type in a password

Once done, two files exist: hello.txt and hello.txt.gpg. Let's print both:

cat hello.txt      # Prints hello world
cat hello.txt.gpg  # Prints binary garbage

As you can see, the original file is not removed, but an encrypted copy with a .gpg extension is created in addition.

Note that gpg does cache the secret key, as it states in the manpage:

gpg caches the passphrase used for symmetric encryption so that a decrypt operation may not require that the user needs to enter the passphrase. The option --no-symkey-cache can be used to disable this feature.

So if you purposefully try to decrypt the .gpg file, and wonder why you didn't have to enter a password - this is why.


are you sure you checked the right file? By default, GPG creates a new, encrypted file (filename.gpg). You can also open the file in a Hex-Editor, a GPG-encrypted file looks like random data/bytes like in the example below:

00000000  8c 0d 04 09 03 02 99 03  47 32 6b e6 d3 75 ff d2  |........G2k..u..|
00000010  c0 26 01 40 c9 5e 7e 6f  e2 bb 06 6c 26 05 a9 ee  |.&.@.^~o...l&...|
00000020  7a fc ef 1a 8d 3e 37 ad  c4 11 f5 83 c2 1a a3 f7  |z....>7.........|
00000030  bf 0a b4 df 91 e3 28 8d  bc 14 0c 02 91 9d 13 f5  |......(.........|
00000040  04 e9 2f f6 db a5 0b 90  72 32 ca cd e7 5c d6 44  |../.....r2...\.D|

You must log in to answer this question.