Re: [general] Encrypting/Decryption

From: Naveed Shaikh <naveed(dot)shaikh(at)enterprisedb(dot)com>
To: VENKTESH GUTTEDAR <venkteshguttedar(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: [general] Encrypting/Decryption
Date: 2014-11-17 11:46:50
Message-ID: CAC50kKjDS6xHJo9EMYbS4kV7Bd=CmziOCWUO+WOp3AF=sVy_TA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Venktesh,

Following is small test case:
======================

leon=# create table demo(pw bytea);
CREATE TABLE
leon=# insert into demo(pw) values ( encrypt( 'data', 'key', 'aes') );
INSERT 0 1
leon=# select decrypt(pw, 'key', 'aes') FROM demo;
decrypt
------------
\x64617461
(1 row)

leon=# select convert_from(decrypt(pw, 'key', 'aes'), 'utf-8') FROM demo;
convert_from
--------------
data
(1 row)

BTW, please think carefully about whether PgCrypto is really the right
choice. Keys in your queries can be revealed in pg_stat_activity and the
system logs via log_statement or via crypto statements that fail with an
error.

You can follow the below link for more information regarding the encryption
options:

http://www.postgresql.org/docs/9.3/static/encryption-options.html

Hope this helps.

Thanks & Regards,
Naveed Shaikh
Senior Systems Engineer

To reach Support Call:
US: +1-732-331-1320 - UK: +44 - 2033719820
Brazil: +55-2139581371 - India: +91-20-32676535

Are you updated: Latest version of Postgres Plus Advanced Server are
8.4.19.42, 9.0.17.35, 9.1.13.21, 9.2.8.19 and 9.3.4.10

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

On Mon, Nov 17, 2014 at 4:53 PM, VENKTESH GUTTEDAR <
venkteshguttedar(at)gmail(dot)com> wrote:

> Hello,
>
> As i am new to postgresql and django. please help me to acheive the
> following.
>
> I have created a database with some tables and i want to encrypt the
> data in database tables, so please someone guide me how to do it.?
>
> i want to encrypt the data and also decrypt through django, so tell me
> which is right way either to use pgcrypto or pycryto,
> i am not understanding neither of them. please help.
>
> --
> Regards :
> Venktesh Guttedar.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2014-11-17 12:48:36 Re: [general] Encrypting/Decryption
Previous Message VENKTESH GUTTEDAR 2014-11-17 11:23:43 [general] Encrypting/Decryption