geektron has asked for the wisdom of the Perl Monks concerning the following question:
today I'm working on replacing the Crypt::DES with Crypt::CBC to allow for arbitrary-length password strings, but I can't get validation/ verification of the passwords from the cookie.
in the set_cookie routine:
and the new $epassword is tossed into the cookie.my $cipher = Crypt::CBC->new( {'key' => 'stringie', 'cipher' => 'DES', 'iv' => 'vectory!', 'regenerate_key' => 0, # default true 'padding' => 'space', 'prepend_iv' => 1 } ); my $epassword = $cipher->encrypt_hex($password);
and later ( on subsequent hits to the app, essentially) we check the cookie pass against the DB pass like so:
where $dbpw is just fetched from the DB based on the username ....my $cipher = Crypt::CBC->new( {'key' => 'stringie', 'cipher' => 'DES', 'iv' => 'vectory!', 'regenerate_key' => 0, # default true 'padding' => 'space', 'prepend_iv' => 1 } ); my $dbpwmd5 = $cipher->encrypt_hex($dbpw);
and the values don't match. the newly encrypted $dbpw and the value from the cookie, that is.
after reading a couple other nodes ( Crypt::CBC question, Safe symmetric encryption - Crypt::CBC + Crypt::Blowfish? ) a block cipher (like DES) should allow for comparision.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Crypt::CBC and verifying passwords
by Belgarion (Chaplain) on May 19, 2004 at 17:56 UTC | |
by geektron (Curate) on May 19, 2004 at 18:35 UTC | |
Re: Crypt::CBC and verifying passwords
by jdtoronto (Prior) on May 19, 2004 at 17:58 UTC | |
by kutsu (Priest) on May 19, 2004 at 18:34 UTC | |
Re: Crypt::CBC and verifying passwords
by Ryszard (Priest) on May 19, 2004 at 18:02 UTC | |
by geektron (Curate) on May 19, 2004 at 18:05 UTC | |
Re: Crypt::CBC and verifying passwords
by Anonymous Monk on May 19, 2004 at 21:07 UTC |