X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 90CE3D97AE for ; Wed, 2 Nov 2005 17:01:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67860-01 for ; Wed, 2 Nov 2005 21:01:19 +0000 (GMT) Received: from localhost.localdomain (unknown [12.31.43.201]) by svr1.postgresql.org (Postfix) with ESMTP id 8C342D9644 for ; Wed, 2 Nov 2005 17:01:20 -0400 (AST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.13.4/8.13.4) with ESMTP id jA2L1NFS000523; Wed, 2 Nov 2005 16:01:23 -0500 Received: from localhost (localhost [[UNIX: localhost]]) by localhost.localdomain (8.13.4/8.13.4/Submit) id jA2L1Kef000522; Wed, 2 Nov 2005 16:01:20 -0500 From: "Mark R. Dingee" To: pgsql-sql@postgresql.org Subject: Re: PGSQL encryption functions Date: Wed, 2 Nov 2005 16:01:19 -0500 User-Agent: KMail/1.8.2 Cc: Bruno Wolff III References: <200511011438.06610.mark.dingee@cox.net> <200511011700.50776.mark.dingee@cox.net> <20051102185930.GA10108@wolff.to> In-Reply-To: <20051102185930.GA10108@wolff.to> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200511021601.20138.mark.dingee@cox.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200511/33 X-Sequence-Number: 23285 Thanks Bruno. I'm using a hash so I can merge info available in the HTTPS header with data I store on the server so that the hash can be reconstructed during the validation process from the raw elements. Tom Lane reminded me of using random seeds similar to what you are suggesting. I think I will try to incorporate that into the process. Perhaps a segment from the initial SSL_SESSION_ID may work without generating too much overhead. You're right, sniffing isn't a real concern for me in this application. My biggest concern is internal users playing around trying to find a backdoor into sensitive data. Thanks Mark On Wednesday 02 November 2005 01:59 pm, Bruno Wolff III wrote: > On Tue, Nov 01, 2005 at 17:00:50 -0500, > > "Mark R. Dingee" wrote: > > Bruno, > > > > I use an authenticate() function as a part of state maintenance in a PHP > > web app. In the function, I generate an encrypted token that is then > > used in the validation process on subsequent pages. md5 works, but I've > > been able to brute-force crack it very quickly, so I'm looking for an > > alternative. Any thoughts would be greatly appreciated. > > This isn't a problem with MD5. While MD5 does have some theoretical > weaknesses, they aren't really an issue in this case. > > Why are you using a hash at all? If you are using the hash as a key, why > not just use a random string instead? The web browser could be handed a > session id and random string and on the server you would have a table > indexed by session ids that includes the random string. > > On many systems you can use /dev/urandom as a source of random data. Since > you don't seem to be concerned about sniffing, /dev/random is probably > overkill and having it block when low on entropy would probably be a > problem for you. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend