Apache::CryptHash

Apache::CryptHash is a Perl module with encrypted tokens for cookies.
Download

Apache::CryptHash Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Michael Robinton
  • Publisher web site:
  • http://search.cpan.org/~miker/Net-DNS-Codes-0.09/Codes.pm

Apache::CryptHash Tags


Apache::CryptHash Description

Apache::CryptHash is a Perl module with encrypted tokens for cookies. Apache::CryptHash is a Perl module with encrypted tokens for cookies.Creates an encrypted cookie-like string with a MAC (checksum) from a hash of critical and non-critical values. The MAC is created on only the critical values. Decryption will fail if the string has been altered and the MAC does not match when the string is decrypted.Particularly useful when using COOKIES and will do all the hard work for Apache::AuthCookieinit()Create class reference and set passcode to the value returned by Sys::Hostname::hostname; my $c = Apache::CryptHash->init; # default passcode = hostnameinit takes an optional parameter my $c = Apache::CryptHash->init('no'); $c->passcode('no'} # will turn encryptation off # and put in Debug modeOptionally, the passcode or debug may be set by $c->passcode('no') # will turn encryptation off # and put in Debug mode $c->passcode('newpasscode'); # change the passcodename & passcodeHash Header may be set to any string $c->name('some_string'); # default 'Secret'Just remember to obey the rules for allowed characters in cookie strings for both name & passcodeencode()Generate an encrypted cookie-like value from a hash. Optional invarient values may be specified for a MAC $c->encode(%state, @mac_keys).Only the crypt secret and the mac_keys valuess are present in the MAC. What is returned is NAME:crypted_string (NAME.Debug:crypted_string)where $c->pascode(somename) (default 'Secret')decode($$$)Decrypt and generate state hash from the encrypted hash $c->decode($cookie,%state, @mac_keys);Return false if decode or MAC failsmd5_hex($)Return the md5 hash of input string.md5_b64($)Return the md5 base 64 hash of input string.checkMAC $c = Apache::CryptHash->init('some password'); $c->checkMAC(%state, @mac_keys)Does a comparison of the MAC in the %state vs the calculated value based on @mac_keys and returns a boolean result.Don't forget to set the passcode or the check will fail! Requirements: · Perl


Apache::CryptHash Related Software