Differentiating GPG data from random data

Bernd Eckenfels lists-gnupgdev at lina.inka.de
Fri Nov 28 04:42:40 CET 2008


On Tue, Nov 25, 2008 at 09:09:09AM -0500, Ted wrote:
> Thank you for the information. It confirms what I thought after
> reading the RFCs. It would be better for me to accidentally include
> some GPG files rather than accidentally exclude files I'm searching
> for. I can manually look at the files and use GnuPG to easily tell the
> GPG ones from the non-GPG ones.

you could run

  gpg --dry-run --list-packets --batch --home empty/ --status-fd 1 <file>

and check "NODATA" on stdout. Unfortunatelly a malformed PGP packet will
have the same return code (2) than a encrypted message (at least in my 1.4.1
which i tried the NO DATA and NO_SECKEY both cause exit code 2).

This will detect lots of (valid) OpenPGP files. Not sure if there are saner
options to actually make gpg not do anything.

Gruss
Bernd
-- 
  (OO)     -- Bernd_Eckenfels at Mörscher_Strasse_8.76185Karlsruhe.de --
 ( .. )    ecki@{inka.de,linux.de,debian.org}  http://www.eckes.org/
  o--o   1024D/E383CD7E  eckes at IRCNet  v:+497211603874  f:+49721151516129
(O____O)  When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!



More information about the Gnupg-devel mailing list