Dave Cross: Still Munging Data With Perl: Online event - Mar 17 Learn more

NAME

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

SYNOPSIS

$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);

DESCRIPTION

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
/usr/local/bin/gpg
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
or
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
$outstring
if the input was a string

DEPENDENCIES

Mail::SpamCannibal::ParseMessage
and
You must install at least one of the following
on your system to use this module.
PGP
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
or
outside US: PGP 6.5.8
i.e. 'pgpsrc658unix-gnu.tar.gz',
PGPcmdln_6.5.8.Lnx_FW.tar.gz,
or PGPcmdln_6.5.8.Lnx_FW.rpm.tar
2.6.2 rebel was the default used to
develop this module.
GnuPG

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

EXPORT_OK

decrypt
is_pgp
whiteclean

AUTHOR

Michael Robinton <michael@bizsystems.com>

COPYRIGHT

Copyright 2003 - 2004, Michael Robinton <michael@bizsystems.com> 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.

SEE ALSO

perl(1)