Identify a gpg file (was: file extension confusion: --clearsign makes binary .asc)

Werner Koch wk at
Thu Jul 25 18:05:08 CEST 2013

On Thu, 25 Jul 2013 17:05, hans at said:

> "gpg2 --import" or "gpg2 --decrypt".  I want GPG on Android to be able to
> receive a .gpg file and then do the right thing without the user having to
> tell GPG that the .gpg file is keys, encrypted content, a signed file, etc.

You are right.  GPGME needs to know what it shall do.  Although gpg
usually does the right thing, it does not automatically import files -
you need to use --import.  I would consider the latter a feature.

Back to GPGME.  I recall that for some projects we often talked about
your needs but eventually get around it with simple methods.  For
example GpgEX (the Windows file explorer extension) uses a list of
suffixes to decide whether to show sign/encrypt or verify/decrypt at the
top of the context menu.  This more or less works but is not very
comfortable.  GPA (src/filetype.c) and GpgOL have code to distinguish
between CMS/X.509 and OpenPGP but that is all we have.

I agree that a generic function in GPGME to do what file(1) does for
OpenPGP files would be quite useful.  Unfortunately we have not yet had the
time to implement it.   src/filetype.c along with a list of commonly
used suffixes might be a start, though.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-devel mailing list