Is it possible to decide what is a gpg file?

David SMITH dave.smith at
Tue Nov 17 17:28:17 CET 2009

On Tue, Nov 17, 2009 at 10:52:29AM -0500, Melikamp The Medley wrote:
> Sorry if you get two of these, I screwed up while subscribing
> to the list.
> I have a question relating to the symmetric encryption. If I do
> gpg -c foo-file
> and enter a passphrase, I get an encrypted foo-file.gpg.
> Is there a way to tell that it is an encrypted file just by
> looking at the contents? I mean, is there a reliable way to
> tell that something is _not_ an encrypted file?

Depends on what you mean by "reliable"...

I'm sure if you read RFC-4880, you could work out a byte pattern that
would give a very good indication, for most practical purposes.

However, it would probably be possible for someone to generate a file
artificially in a deliberate attempt to fool the filetype detection
mechanism.  So, it's not "reliable" because it can be fooled
intentionally, but for most likely scenarii (i.e. where people aren't
deliberately trying to fool it), it would work.

If you're running on UNIX (particularly Linux), look at 'man file'.

David Smith        | Tel: +44 (0)1454 462380    Home: +44 (0)1454 616963
STMicroelectronics | Fax: +44 (0)1454 462305  Mobile: +44 (0)7932 642724
1000 Aztec West    | TINA: 065 2380          GPG Key: 0xF13192F2
Almondsbury        | Work Email: Dave.Smith at
BRISTOL, BS32 4SQ  | Home Email: David.Smith at

More information about the Gnupg-users mailing list