encryption problem

Started by Sylvain Sainnierover 23 years ago4 messagesgeneral
Jump to latest
#1Sylvain Sainnier
sainnier@avignon.inra.fr

Hello

I would encrypt data that I insert in my table, and I don't know how to do
this.
can you help me

thanks

#2Justin Clift
justin@postgresql.org
In reply to: Sylvain Sainnier (#1)
Re: encryption problem

Hi Sylvain,

There are a couple of general approaches to encrypting your data, and it
depends on what you really need.

Are you after a way to encrypt *everything* in your database (no
problem), or just some specific data?

Something to remember is that unless you want to write special
functions, any data that you encrypt and put in a table loses a bunch of
SQL abilities.

i.e.

Let's say you have three strings that you encrypt.

a) 'foo' becomes 'adfasdfs32sdf'
b) 'bar' becomes 'ds3sdf93jsl3s'
c) 'baz' becomes 'bsadf823js83j'

And you then store these in a database like this:

something | crypted
++++++++++++++++++++++++++
alpha | adfasdfs32sdf
bravo | ds3sdf93jsl3s
charlie | bsadf823js83j

Suddenly reasonable no longer becomes easy:

i.e.

SELECT crypted FROM sometable WHERE crypted = 'xyz' ORDER BY crypted;

This wouldn't give the same type of results as if the data hadn't been
encrypted, etc.

In this scenario it can be a better idea to have the whole database
inside an encrypted disk partition (see www.kerneli.org if you're on
Linux), as that will let you do all of your normal SQL, etc.

Hope this helps.

:-)

Regards and best wishes,

Justin Clift

Sylvain Sainnier wrote:

Hello

I would encrypt data that I insert in my table, and I don't know how to do
this.
can you help me

thanks

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi

#3Bruce Momjian
bruce@momjian.us
In reply to: Sylvain Sainnier (#1)
Re: encryption problem

Sylvain Sainnier wrote:

Hello

I would encrypt data that I insert in my table, and I don't know how to do
this.
can you help me

I would look at /contrib/pgcrypto for encryption/decryption routines.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Jan Wieck
JanWieck@Yahoo.com
In reply to: Bruce Momjian (#3)
Re: encryption problem

Bruce Momjian wrote:

Sylvain Sainnier wrote:

Hello

I would encrypt data that I insert in my table, and I don't know how to do
this.
can you help me

I would look at /contrib/pgcrypto for encryption/decryption routines.

Or look into encrypting the entire filesystem you have your data
directory in. There are several commercial products and I've seen
a HOWTO for Linux somewhere that describes it with open source
stuff. Basically you mount a huge encrypted file through the
loopback device and an encrypt/decrypt driver.

Jan

--
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being
right. #
# Let's break this rule - forgive
me. #
#==================================================
JanWieck@Yahoo.com #