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 0578C9FA170 for ; Mon, 17 Jul 2006 13:26:39 -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 14054-04-3 for ; Mon, 17 Jul 2006 13:26:34 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 00F509FB1DF for ; Mon, 17 Jul 2006 13:26:16 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by svr4.postgresql.org (Postfix) with ESMTP id C10E45AFB27 for ; Mon, 17 Jul 2006 15:56:56 +0000 (GMT) Received: by nf-out-0910.google.com with SMTP id n15so651892nfc for ; Mon, 17 Jul 2006 08:55:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=TIj1W88nuKNESIE1hZL7R+9Etr1oM+Yk7VJoTD0ugbGPzHFDnK0h9q+yfnK22hPgjAu2kzg/L2iGRRkBf9RLDlxT5uJ04IvL5Q/cwlBTGuvL0OO70kxV1kwVXZ8NNm3nhsazMHubHA9StZ8sQPDJ8Ck123IdGZJ8HG+Yu0TBfY8= Received: by 10.78.185.7 with SMTP id i7mr909013huf; Mon, 17 Jul 2006 08:55:53 -0700 (PDT) Received: by 10.78.32.10 with HTTP; Mon, 17 Jul 2006 08:55:53 -0700 (PDT) Message-ID: Date: Mon, 17 Jul 2006 10:55:53 -0500 From: "Aaron Bono" To: "John Tregea" Subject: Re: Storing encrypted data? Cc: "Michael Fuhr" , pgsql-sql@postgresql.org In-Reply-To: <44BB28AC.3070302@debraneys.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7620_6741517.1153151753178" References: <44BAE3B0.8060403@debraneys.com> <20060717030705.GA87022@winnie.fuhr.org> <44BB28AC.3070302@debraneys.com> X-Google-Sender-Auth: ea5655ff33185043 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/226 X-Sequence-Number: 25800 ------=_Part_7620_6741517.1153151753178 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ================================================================== ------=_Part_7620_6741517.1153151753178 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/17/06, John Tregea <john@debraneys.com> 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
================================================================== ------=_Part_7620_6741517.1153151753178--