Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Two-Way Password Encryption

by sschneid (Deacon)
on May 07, 2003 at 14:38 UTC ( [id://256216]=note: print w/replies, xml ) Need Help??


in reply to Two-Way Password Encryption

Some (untested) code...

Set the cookie containing the username and an encrypted key (the password + $key):
use Crypt::CBC; my $key = 'kjhAG43asoiudy3kjq43ajhali87LOljkYilKH84yiHLkjklasjsd98fu'; my $cipher = new Crypt::CBC($key,'Blowfish'); my $crypt = $cipher->encrypt($password); $cgi = new CGI; my $auth = "$user,$crypt"; $cookie = $cgi->cookie ( -name => 'hostauth', -value => $auth ); print $cgi->header (-type => 'text/html', -cookie => $cookie);
And then, whenever you want, you can decrypt the key in the cookie (using the same $key) and send it along to the LDAP server:
use Crypt::CBC; my $key = 'kjhAG43asoiudy3kjq43ajhali87LOljkYilKH84yiHLkjklasjsd98fu'; my $cipher = new Crypt::CBC($key,'Blowfish'); my $auth = $cipher->decrypt($cookie); # Send the $auth to the LDAP server...
-s.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://256216]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-19 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found