X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 05CAF9FA434 for ; Wed, 19 Jul 2006 05:42:17 -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 85521-07 for ; Wed, 19 Jul 2006 05:42:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgate1.pacific.net.sg (smtpgate1.pacific.net.sg [203.120.90.31]) by postgresql.org (Postfix) with SMTP id 386279FA430 for ; Wed, 19 Jul 2006 05:42:10 -0300 (ADT) Received: (qmail 5726 invoked from network); 19 Jul 2006 08:42:08 -0000 Received: from ppp1.dyn76.pacific.net.sg (HELO ?127.0.0.1?) (debraneys@210.24.76.1) by smtpgate1.pacific.net.sg with (DHE-RSA-AES256-SHA encrypted) ESMTPA; 19 Jul 2006 08:42:04 -0000 Message-ID: <44BDF054.5060603@debraneys.com> Date: Wed, 19 Jul 2006 16:41:56 +0800 From: John Tregea User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Aaron Bono CC: Michael Fuhr , pgsql-sql@postgresql.org Subject: Re: Storing encrypted data? References: <44BAE3B0.8060403@debraneys.com> <20060717030705.GA87022@winnie.fuhr.org> <44BB28AC.3070302@debraneys.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/243 X-Sequence-Number: 25817 Hi Aaron, I found that your suggestion worked well. For some reason the IDE I use (Revolution) put a return character every 73rd character when it did the base64encode, but I strip those out and there no further problems. I don't even have to put them back later to decode it. Thanks John T Aaron Bono wrote: > On 7/17/06, *John Tregea* > wrote: > > Hi Michael, > > Thanks for your advice. I was looking at the bytea data type in the > PostgreSQL book I bought (Korry and Susan Douglas, second edition). I > was concerned that if I have to escape certain characters like the > single quote or the backslash, how do I guarantee that the escaped > version does not already appear in the encrypted string? > > Should I use the octal value to escape the single quote (\047) and > backslash (\\134)? > > Those character sequences are extremely unlikely to occur in an > encrypted string. > > Is the the right approach ? > > Also... I note that I cannot change the data type of my field from > text > to bytea (I am using PGADMIN III). Do you know why? > > > > When I have data like this, I do a Base64 encoding. The string ends > up longer but I no longer have to worry about special characters > mucking things up. > > ================================================================== > Aaron Bono > Aranya Software Technologies, Inc. > http://www.aranya.com > ==================================================================