-----BEGIN PGP SIGNED MESSAGE----- More code... #!/usr/bin/perl # name: pgpcheck.pl # purpose: Prints STDIN to STDOUT if it is encrypted with PGP/GPG. # requires: /bin/tempfile from debianutils, /usr/bin/gpg # TODO: # Does it need to detect Mixmaster messages? # It should handle pings (i.e. plain text) to another remailer # by checking rlist or some arbitrary whitelist. # author: septic-admin@nym.alias.net # version: 0.0.1 # date: 4 OCT 2000 # license: GPL if (!-x "/bin/tempfile") { die "requires /bin/tempfile"; } if (!-x "/usr/bin/gpg") { die "requires /usr/bin/gpg"; } my $TMP = `tempfile` || die "cannot create temp file"; my $ENCRYPTED = 0; # Store the file. open(TEMPFILE, ">$TMP") || die "cannot open temp file"; while (<>) { print TEMPFILE; } close(TEMPFILE) || die "cannot close tempfile"; # Test the file. open(GPG, "gpg --batch 2>&1 <$TMP|") || die "cannot open GPG pipe"; while (<GPG>) { if ($_ =~ /^gpg: encrypted/) { $ENCRYPTED = 1; } } close(GPG); # Insert code here to test destination against whitelist (for pings). # Print the file to STDOUT if it is encrypted. if ($ENCRYPTED) { open(TEMPFILE, "<$TMP") || die "cannot reopen temp file"; while (<TEMPFILE>) { print; } close(TEMPFILE); } unlink $TMP || die "cannot unlink temp file"; -----BEGIN PGP SIGNATURE----- Version: 2.6.3a Charset: noconv iQCVAwUBOdzoJHT63FdzI1K1AQGPZwP5ARcY7EhDTNjXm5vQoYK2HFymN295ia3U RnqG8UJHfmjtXXooucmM0VOhsMfo5GS1M5uJIxH4b9YsrDTSNDjydwHEhe6ajcAw Ix78PIslzcXrFTLq/EowDtZ0MvuFWpnC/sgJAVYOAZyK3iYOf3yG85vHrOVVP9ot Ch+e7lDp/AE= =zC7G -----END PGP SIGNATURE-----