Gossamer Forum
Home : Products : DBMan : Customization :

Password Encryption

Quote Reply
Password Encryption
Is the password encryption part of dbman unique to dbman? In other words, could I change some of the characters so that someone else's db.pass file would not work with my installation of dbman?

Code:
open (PASS, ">>$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($in{'pw'}, $salt);
my $permissions = join (":", @auth_signup_permissions);

print PASS "$in{'userid'}:$encrypted:$permissions\n";
close PASS;

The purpose of this is that I write data files to the server and I'd love to be able to use the same logic as above to "encrypt" the whole file. I've monkeyed around with gpg but I don't need anything "high level", just obstupefaction. (ie, baffle 'em with B.S.)
Quote Reply
Re: [Watts] Password Encryption In reply to
Quote:
could I change some of the characters so that someone else's db.pass file would not work with my installation of dbman?

I don't think so. I think that the crypt function would work the same on all servers using Perl.

Quote:
I'd love to be able to use the same logic as above to "encrypt" the whole file.

The problem is that there is no "decrypt" function so that once you had your database encrypted, you wouldn't be able to read it again. You would have to use something other than the Perl crypt function.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Password Encryption In reply to
Quote:
there is no "decrypt" function

Rats! I just came to that conclusion.

Maybe I can do some whacky substitution thingy

$bob = s/A/%/g;

and then $bob = s/%/A/g; to get it back.