Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id BC9C59FBE8F for ; Tue, 5 Jun 2007 10:31:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 87893-01-2 for ; Tue, 5 Jun 2007 10:31:27 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from eastrmmtao102.cox.net (eastrmmtao102.cox.net [68.230.240.8]) by postgresql.org (Postfix) with ESMTP id C886F9FB662 for ; Tue, 5 Jun 2007 10:26:01 -0300 (ADT) Received: from eastrmimpo01.cox.net ([68.1.16.119]) by eastrmmtao102.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20070605132600.CHVG8985.eastrmmtao102.cox.net@eastrmimpo01.cox.net> for ; Tue, 5 Jun 2007 09:26:00 -0400 Received: from haggis.homelan ([68.105.48.3]) by eastrmimpo01.cox.net with bizsmtp id 7pRy1X00V047iJk0000000; Tue, 05 Jun 2007 09:25:58 -0400 Received: by haggis.homelan (Postfix, from userid 1002) id CDD02240A7F; Tue, 5 Jun 2007 08:25:58 -0500 (CDT) Received: from [192.168.1.10] (haggis.homelan [192.168.1.10]) by haggis.homelan (Postfix) with ESMTP id 0B25F240A80 for ; Tue, 5 Jun 2007 08:22:32 -0500 (CDT) Message-ID: <46656398.1090203@cox.net> Date: Tue, 05 Jun 2007 08:22:32 -0500 From: Ron Johnson User-Agent: Mozilla-Thunderbird 2.0.0.0 (X11/20070601) MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: Encrypted column References: <46645B01.6070605@terra.com.br> <4664983F.4010700@burntmail.com> In-Reply-To: <4664983F.4010700@burntmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=BAYES_50=0.001, FORGED_RCVD_HELO=0.135 X-Spam-Level: X-Archive-Number: 200706/386 X-Sequence-Number: 115209 On 06/04/07 17:54, Guy Rouillier wrote: > Ranieri Mazili wrote: >> Hello, >> >> I need to store users and passwords on a table and I want to store it >> encrypted, but I don't found documentation about it, how can I create >> a table with columns "user" and "password" with column "password" >> encrypted and how can I check if "user" and "password" are correct >> using a sql query ? > > Many people consider two-way encryption to be insecure; two-way > encryption means you can decrypt a value if you know the key, and it is > insecure because you usually have to put the key into the source code. > That means at least one person in your company, the programmer > maintaining the source code, can learn all of your users' passwords. Two-way encryption is needed for companies that store customer credit cards. But yes, I've always worried about that. > One > way around that is to hash the value instead. Then to validate, at > runtime you hash the user-entered password using the same hash function, > and validate that it matches the stored hash. No one in your company > ever knows end-user passwords. > -- Ron Johnson, Jr. Jefferson LA USA Give a man a fish, and he eats for a day. Hit him with a fish, and he goes away for good!