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

NAME

LibWeb::Crypt - Encryption for libweb applications

SUPPORTED PLATFORMS

BSD, Linux, Solaris and Windows.

REQUIRE

  • Crypt::CBC

  • Crypt::Blowfish (recommended), Crypt::DES or Crypt::IDEA

ISA

  • LibWeb::Class

SYNOPSIS

  use LibWeb::Crypt;
  my $c = new LibWeb::Crypt();

  my $cipher =
      $c->encrypt_cipher(
                         -data => $plain_text,
                         -key => $key,
                         -algorithm => 'Crypt::Blowfish',
                         -format => 'hex'
                        );

  my $plain_text =
      $c->decrypt_cipher(
                         -cipher => $cipher,
                         -key => $key,
                         -algorithm => 'Crypt::Blowfish',
                         -format => 'hex'
                        );

  my $encrypted_pass =
      $c->encrypt_password('password_in_plain_text');

ABSTRACT

This class provides methods to

  • encrypt data of arbitrary length into cipher (binary or hex) by using the algorithm provided by Crypt::Blowfish, Crypt::DES or Crypt::IDEA, and chained by using Crypt::CBC,

  • decrypt ciphers generated by this class,

  • encrypt plain text password by using the perl's crypt() routine with randomly chosen salt.

The current version of LibWeb::Crypt is available at

   http://libweb.sourceforge.net

Several LibWeb applications (LEAPs) have be written, released and are available at

   http://leaps.sourceforge.net

DESCRIPTION

METHODS

encrypt_cipher()

Params:

  -data=>, -key=>, -algorithm=>, -format=>

Pre:

  • -data is the data to be encrypted as cipher,

  • -key is the private key such the same key is needed to decrypt the cipher (sorry, I do not have a rigorous definition for that right now),

  • -algorithm must be 'Crypt::Blowfish', 'Crypt::DES' or 'Crypt::IDEA',

  • -format is the format of the cipher, which must be either 'binary' or 'hex'.

Post:

  • Encrypt -data and return the cipher.

Note: this makes use of the Crypt::CBC module and therefore can accept data of arbitrary length.

decrypt_cipher()

Params:

  -cipher=>, -key=>, -algorithm=>, -format=>

Pre:

  • -cipher is the cipher to be decrypted,

  • -key is the private key such that it is the same key used to encrypt the original data of -cipher (sorry, I do not have a rigorous definition for that right now),

  • -algorithm must be 'Crypt::Blowfish', 'Crypt::DES' or 'Crypt::IDEA' and it must match the algorithm used when preparing the cipher,

  • -format is the format of the cipher, which must be either 'binary' or 'hex'.

Post:

  • Decrypt -cipher and return the original data.

encrypt_password()

Usage:

  my $encrypted_password =
      $crypt->encrypt_password($password_in_plain_text);

Encrypts the parameter (usually a password) and returns a 13-character long string using the perl's crypt() routine and randomly chosen salt.

AUTHORS

Colin Kong (colin.kong@toronto.edu)

CREDITS

Lincoln Stein (lstein@cshl.org)

BUGS

SEE ALSO

Digest::HMAC, Digest::SHA1, Digest::MD5, Crypt::CBC, Crypt::Blowfish, Crypt::DES, Crypt::IDEA, LibWeb::Admin, LibWeb::Digest, LibWeb::Session.