X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 307649FA5E2 for ; Tue, 30 May 2006 12:10:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 25965-06 for ; Tue, 30 May 2006 12:10:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pjetlic.mobart.hr (pjetlic.mobart.hr [80.80.51.10]) by postgresql.org (Postfix) with ESMTP id 4A6EF9FA5E6 for ; Tue, 30 May 2006 12:10:05 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pjetlic.mobart.hr (Postfix) with ESMTP id 314A017A97; Tue, 30 May 2006 17:10:04 +0200 (CEST) Received: from pjetlic.mobart.hr ([127.0.0.1]) by localhost (pjetlic [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 01661-01-12; Tue, 30 May 2006 17:10:04 +0200 (CEST) Received: from mike.mobart.hr (mike.mobart.hr [192.168.10.94]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by pjetlic.mobart.hr (Postfix) with ESMTP id 152A517A95; Tue, 30 May 2006 17:10:04 +0200 (CEST) Subject: Re: hi i need to encrypt one field in a table From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: pgsql-sql@postgresql.org Cc: "Penchalaiah P." In-Reply-To: References: Content-Type: text/plain Organization: Mob-Art Date: Tue, 30 May 2006 17:09:54 +0200 Message-Id: <1149001795.18422.35.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by OpenSource AV+AS Mail Server X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/203 X-Sequence-Number: 25234 On Tue, 2006-05-30 at 15:42 +0530, Penchalaiah P. wrote: > Hello, > I want to create a table with an encrypted field for a password entry, so > that you can see only ********. > And can I encrypt fields which datatype is an integer or a timestamp? No can do. I mean, you can't do something like that. You can either give (actually, revoke) that particular user/role permisions to read the table with the passwords, or you could store hashed values to the database. Later is prefered, I'd say. You could use md5() function to create hashes, store those in the database, and when checking for the credentials compare the hases. You'd compare user input flushed trough md5() function with the hash you have in the database. That way you don't know what user passwords are, and you could only set a new password if user forgets his/hers password. You don't need encrypted passwords. Mario -- Mario Splivalo Mob-Art mario.splivalo@mobart.hr "I can do it quick, I can do it cheap, I can do it well. Pick any two."