[general] Encrypting/Decryption

Started by VENKTESH GUTTEDARover 11 years ago3 messagesgeneral
Jump to latest
#1VENKTESH GUTTEDAR
venkteshguttedar@gmail.com

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.

#2Naveed Shaikh
naveed.shaikh@enterprisedb.com
In reply to: VENKTESH GUTTEDAR (#1)
Re: [general] Encrypting/Decryption

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@gmail.com> wrote:

Show quoted text

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.

#3Bill Moran
wmoran@potentialtech.com
In reply to: VENKTESH GUTTEDAR (#1)
Re: [general] Encrypting/Decryption

On Mon, 17 Nov 2014 16:53:43 +0530
VENKTESH GUTTEDAR <venkteshguttedar@gmail.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.

I have seen cryptography implemented badly (and by badly, I mean that the
cryptography is just as unsecured as if it wasn't encrypted).

The way in which you're asking leads me to believe that you have a LOT to
learn before you can properly implement cryptographic storage. I recommend
you take a step back and consider the fact that you're far better off
doing the research until you know enough to pick between pgcrypto and
pycrypto on your own.

--
Bill Moran
I need your help to succeed:
http://gamesbybill.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general