Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3C2E8633231 for ; Fri, 16 Jul 2010 14:26:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 78054-10 for ; Fri, 16 Jul 2010 17:26:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f174.google.com (mail-px0-f174.google.com [209.85.212.174]) by mail.postgresql.org (Postfix) with ESMTP id 1D15E632EDF for ; Fri, 16 Jul 2010 14:26:46 -0300 (ADT) Received: by pxi14 with SMTP id 14so1012690pxi.19 for ; Fri, 16 Jul 2010 10:26:45 -0700 (PDT) Received: by 10.114.60.3 with SMTP id i3mr1892666waa.228.1279301199153; Fri, 16 Jul 2010 10:26:39 -0700 (PDT) Received: from Craig-Jamess-MacBook-Pro.local (wsip-70-167-124-126.sd.sd.cox.net [70.167.124.126]) by mx.google.com with ESMTPS id k23sm25084681waf.17.2010.07.16.10.26.37 (version=SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 10:26:38 -0700 (PDT) Message-ID: <4C40964B.4050606@emolecules.com> Date: Fri, 16 Jul 2010 10:26:35 -0700 From: Craig James User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: Kris Deugau , pgsql-admin@postgresql.org Subject: Re: secret key for encryption References: <4C4038AC0200002500033716@gw.wicourts.gov> <4C4038EC0200002500033719@gw.wicourts.gov> <4C4038EC0200002500033719@gw.wicourts.gov> <4C408F49.10605@emolecules.com> <4C409372.6060102@vianet.ca> In-Reply-To: <4C409372.6060102@vianet.ca> 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.001 tagged_above=-10 required=5 tests=BAYES_20=-0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/112 X-Sequence-Number: 35131 Kris, [Replying to list, too.] On 7/16/10 10:14 AM, Kris Deugau wrote: > Craig James wrote: >> This isn't exactly a Postgres question, but I hope someone in the >> community has solved it. >> >> I want to encrypt some data in Postgres that arrives from Apache. How >> do you store an encryption key in such a way that Apache CGIs can get >> it, but a hacker or rogue employee who manages to access the machine >> can't find out the encryption key? > > Short answer: You don't. > > Longer answer: You can tie things up with public-key encryption so that > a different system can retrieve the data, but the system that put it in > can't because it only has the public (encryption) key, not the private > (decryption) key. > > Even that isn't safe from a rogue employee - what if that rogue is your > seniour sysadmin with full root access on all your systems? If we assume no escalation of priviliges, that is, Apache stays apache and users can't escalate to root, what then? This must be a solved problem. Credit-card numbers are required to be encrypted by law. It wouldn't make sense for them to be encrypted but then find that the password is sitting around where anyone can find it. There must be any number of Postgres users who store encrypted credit card numbers and other personal data. How do they solve this problem? Craig