View on
Michael Robinton > Mail-SpamCannibal > Mail::SpamCannibal::GoodPrivacy



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.03   Source  


  Mail::SpamCannibal::GoodPrivacy - PGP for spamcannibal mail


  use Mail::SpamCannibal::GoodPrivacy;

  $plaintext = decrypt(\$hash);
        or      -- defaults shown
  $plaintext = decrypt(
        Data      => $data,
        ExeFile   => '/usr/local/bin/pgp',
        KeyPath   => '.pgp',
        Password  => 'sometext',
        UserID    => 'default userid',
        Version   => '2.62',

  ($begin,$end) = is_pgp(\@lines,\$err);
  $nullchar = whiteclean(\@array);
  $outstrng = whiteclean($instring);


Mail::SpamCannibal::GoodPrivacy is a standardized wrapper around 'pgp2x', 'pgp6x', or 'gnupg' that provides encryption and decryption for IPTable::IPv4::DBTables::SpamCannibal.

Mail::SpamCannibal::GoodPrivacy has been tested using pgp-2.6.2g, pgp-6.5.8, and gpg-1.2.2 on RSA keys generated by pgp-2.6.2g which are included with this distribution.

Utilities to verify that a message has PGP encrypted content prior to decryption so that plain text messages are not inadvertently passed to the decrypt program;

$plaintext = decrypt(\$hash);
  Decrypt an encoded message.

  input:        a hash or hash pointer
  return:       plaintext or '' on error

  %hash = (
        Data      => $data,
        ExeFile   => '/usr/local/bin/gpg',
        KeyPath   => './',
        Password  => 'sometext',
        UserID    => '',
        Version   => '',

    Data:       data to decrypt

    ExeFile:    location of executable
        i.e.    /usr/local/bin/pgp

        WARNING: use appropriate default
                 keyring names.

    KeyPath:    directory for keyrings

    Password:   password for decryption

    UserID:     Optional default user for decryption.

                The user 'name' or keyID

        i.e.    'test' or

                E56C91B9 as displayed by
                pgp -kv ./keyrings/secring.pgp
                ENVGPGHOME=./keyrings gpg --list-secret-keys

    Version:    Version compliance (gpg only)
                (none) for standard gpg,
                2.6x and 6.x for pgp support
($begin,$end) = is_pgp(\@lines,\$err);

Test an array of lines to determine if they represent a valid PGP encrypted message.

  input:        pointer to array of lines,
                [optional] pointer to 
                error return string

  returns:      () empty array on failure
    or  begin = pointer to -----BEGIN PGP
        end   = pointer to -----END
    for the input array

    $err will contain and empty string
        on success or a text message
        indicating the failure reason

        not an array ref
        signed cleartext
        no BEGIN PGP
        no blank line
        no armor text
        invalid armor
        no END
  i.e.  if (@_ = is_pgp(\@lines)) {
          ($begin,$end) = @_;
        } else {
          # sorry, not a PGP message
$nullchar = whiteclean(\@array);

See below:

$outstrng = whiteclean($string);

Cleans trailing whitespace from a text string or an array of text lines.

If the input is an array pointer to an array of text lines, cleans the lines of trailing whitespace in place.

If the input is a string, returns a string with trailing whitespace removed.

  input:        array pointer
           or   string
  returns:      '' if input = ARRAY
           if the input was a string


  You must install at least one of the following
  on your system to use this module.
  Recommend versions of freeware from:

  in the US:    PGP 2.6.2g, the "rebel" version

  outside US:   PGP 2.6.3i
  i.e. pgp263is.tar.gz + pgp263i.patch
  outside US:   PGP 6.5.8
  i.e. 'pgpsrc658unix-gnu.tar.gz',
    or  PGPcmdln_6.5.8.Lnx_FW.rpm.tar

  2.6.2 rebel was the default used to 
  develop this module.

If you plan to user PGP 2.6x or 6.x compatibility modes and you are in a country where there are not patent restrictions, then you will also need to download:

and place it in the SRC/gnupg-1.x.x/cipher directory.

NOTE: in all cases the default key file required.
        PGP 2.6.x       pubring.pgp, secring.pgp
        PGP 6.5.8       pubring.pkr, secring.skr
        GnuPG           pubring.gpg, secring.gpg




Michael Robinton <>


Copyright 2003 - 2004, Michael Robinton <> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.



syntax highlighting: