The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Crypt::VERPString - Encrypt and encode fixed-length records for VERP

VERSION

Version 0.02

SYNOPSIS

    use Crypt::VERPString;
    use MIME::Base64;

    my $cv = Crypt::VERPString->new(
        cipher      => 'IDEA',                       # defaults to blowfish
        key         => 'HAHGLUBHAL!@#$!%',           # anything, really
        format      => 'Na*',                        # defaults to a*
        separator   => '!',                          # defaults to -
        encoder     => \&MIME::Base64::encode_base64,# defaults to base32
        decoder     => \&MIME::Base64::decode_base64,# ditto
    );

    my $iv      = 31337;
    my $verp    = $cv->encrypt($iv, 12345, 'hi i am a payload');

    # $verp eq '00007a69!+BT8d1wzW12YSFP5v7AnKVipYZ8rkQIT';

    # do stuff with this value, send to a friend...

    # oops, your friend doesn't exist, the message bounces and you 
    # retrieve the envelope.

    my ($bouncedverp) = ($header =~ /(?:[0-9a-fA-F]{8}!.*)/);

    my ($number, $string) = $cv->decrypt($bouncedverp);

    # now you can do something with this info.

DESCRIPTION

VERP stands for Variable Envelope Return Path. It is the act of inserting some sort of identifying string into the local part of the envelope address of an email, in order to match it to a distinct sending, should the message bounce. This module prepares a string suitable for travel in the deep jungle of SMTP, making it possible to store and retrieve unique envelope data from a bounced message.

This module is also useful for other small payloads that require the same kind of escaping.

METHODS

new PARAMS

cipher

The block cipher to use. Defaults to Blowfish.

key

The secret key.

format

The pack() format. Defaults to "a*".

separator

The separation character between the initialization vector and the payload. Defaults to "-".

encoder

A Subroutine reference to encode the payload. Defaults to MIME::Base32::encode

decoder

A Subroutine reference to decode the payload. Defaults to MIME::Base32::decode

encrypt IV, LIST

Pass in the list and retrieve the unique, encrypted VERP string.

decrypt STRING

Pass in the VERP string and retrieve the original unencrypted list.

AUTHOR

dorian taylor, <dorian@cpan.org>

SEE ALSO

Crypt::CBC

MIME::Base32

http://cr.yp.to/proto/verp.txt

BUGS

The true IV is just the given number and zero, packed into two network longs. I wouldn't recommend really using this for extremely sensitive data, I mean, it's initially designed to fit in the local-part of an email. Ideas and patches are welcome.

Please report any bugs or feature requests to bug-crypt-verpstring@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2005 iCrystal Software, Inc., All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.