Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFWca-00017q-Gj for pgsql-admin@arkaria.postgresql.org; Thu, 25 Oct 2018 03:47:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gFWcY-00054A-9f for pgsql-admin@arkaria.postgresql.org; Thu, 25 Oct 2018 03:47:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFWcC-0003Jh-L7 for pgsql-admin@lists.postgresql.org; Thu, 25 Oct 2018 03:47:21 +0000 Received: from st43p00im-ztdg10071801.me.com ([17.58.63.171]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFWc8-0000rh-4v for pgsql-admin@postgresql.org; Thu, 25 Oct 2018 03:47:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1540439233; bh=PO3ttTeC/utiX0THJ6X0iqUgShBFwcBw7DSxMo1qgTk=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To; b=Y4FwHRp4ocCENy9dYbWN5kNnOPhaXVbYwFA7Gjc/Ttj9yhVxTS1Lz65YJAnqWdYyZ PXNLJqf573TulWK6kVz/NbmP6weJspikjj9e3+/IORySLFQEPJQMGQMpQkOse46Jr5 vh+Q1YMLE/vnJ8mkanPQtJWK6bysFrFzkYlefry3Zvwe74EHYyq1p5hGjJ4wUOKcYX u/I08nyrF9PGQuZdD9BHs21u9byXZlAfnCAPNBCe2BNDnsujofSg9ADJtlk2KD8RCR rYUDvctGGsSG1MNJOWVVBAIrBBbX7ayP+RlFS1SHxkIL729HK6pCPV1TsWG6ML1wsV 4gVPYlaIJwfLg== Received: from [192.168.1.35] (cpe-184-152-57-116.nyc.res.rr.com [184.152.57.116]) by st43p00im-ztdg10071801.me.com (Postfix) with ESMTPSA id 636BE361C7E; Thu, 25 Oct 2018 03:47:13 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: Encryption / Decryption via PGCrypto From: Evan Bauer X-Mailer: iPhone Mail (16A404) In-Reply-To: <20181024090024.jyw2f4l2uygydh3y@office.hexack.fr> Date: Wed, 24 Oct 2018 23:47:11 -0400 Cc: Anjul Tyagi , pgsql-admin@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <95B4AD74-4749-4018-A2F9-93C550E52E69@mac.com> References: <20181024090024.jyw2f4l2uygydh3y@office.hexack.fr> To: =?utf-8?Q?St=C3=A9phane_KANSCHINE?= X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-25_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=594 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810250033 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk All depends on how secure you want to be in the event of a hostile network p= enetration. If the answer is =E2=80=9Cvery=E2=80=9D, consider using a key management sol= ution =E2=80=94 either software (I like Hashicorp Vault) or dedicated HSM ha= rdware from someone like Gemalto or Thales. Having the key on a separate server doesn=E2=80=99t help if the application s= erver is compromised. Cheers, Evan Sent from my iPhone > On Oct 24, 2018, at 05:00, St=C3=A9phane KANSCHINE wr= ote: >=20 >=20 > Hi, >=20 > Le mer. 24 oct., vers 08:27, Anjul Tyagi exprimait : >>=20 >> We are implementing the pgcrypto in our database to encrypt and decrypt t= he >> Column data. for testing purpose we have generate the PGP public / privat= e >> key and use those when we read and write data. >>=20 >> How can we secure the key, if we keep the key outside how can we use that= >> into query. >=20 > We keep the private key on the app server. It communicates with postgres > through SSL and postgres logs aren't too verbose in order to avoid key > exposition. >=20 > If there's a better way, i'm curious of it. >=20 > Regards, > --=20 > St=C3=A9phane KANSCHINE - https://www.hexack.fr./ - https://www.nuajik.io.= / > =EF=BC=A0 stephane@hexack.fr > =EE=88=81 +33 6 64 31 72 52 >=20