pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedEncryption functions
6+ messages / 3 participants
[nested] [flat]
* Encryption functions
@ 2006-05-18 11:21 Thusitha Kodikara <kthusi@yahoo.com>
2006-05-18 12:44 ` Re: Encryption functions Michael Fuhr <mike@fuhr.org>
0 siblings, 1 reply; 6+ messages in thread
From: Thusitha Kodikara @ 2006-05-18 11:21 UTC (permalink / raw)
To: pgsql-sql
Hi,
Are there any encryption functions that can be used in SQL inserts and selects directly ? For example like "select encryptin_function('test_to_be_encrypted'), ........"
Thanks and regards,
-Thusitha
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Encryption functions
2006-05-18 11:21 Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
@ 2006-05-18 12:44 ` Michael Fuhr <mike@fuhr.org>
2006-05-18 13:13 ` Re: Encryption functions D'Arcy J.M. Cain <darcy@druid.net>
2006-05-19 02:43 ` Re: Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
0 siblings, 2 replies; 6+ messages in thread
From: Michael Fuhr @ 2006-05-18 12:44 UTC (permalink / raw)
To: Thusitha Kodikara <kthusi@yahoo.com>; +Cc: pgsql-sql
On Thu, May 18, 2006 at 04:21:19AM -0700, Thusitha Kodikara wrote:
> Are there any encryption functions that can be used in
> SQL inserts and selects directly? For example like
> "select encryptin_function('test_to_be_encrypted'), ........"
See the contrib/pgcrypto module. It has functions like digest()
for making SHA1, MD5, and other digests; hmac() for making Hashed
Message Authentication Codes; and encrypt()/encrypt_iv() and
decrypt()/decrypt_iv() for doing encryption and decryption. Since
8.1 pgcrypto also has functions for doing OpenPGP symmetric and
public-key encryption.
--
Michael Fuhr
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Encryption functions
2006-05-18 11:21 Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
2006-05-18 12:44 ` Re: Encryption functions Michael Fuhr <mike@fuhr.org>
@ 2006-05-18 13:13 ` D'Arcy J.M. Cain <darcy@druid.net>
2006-05-18 13:41 ` Re: Encryption functions D'Arcy J.M. Cain <darcy@druid.net>
2006-05-19 02:55 ` Re: Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
1 sibling, 2 replies; 6+ messages in thread
From: D'Arcy J.M. Cain @ 2006-05-18 13:13 UTC (permalink / raw)
To: Michael Fuhr <mike@fuhr.org>; +Cc: kthusi@yahoo.com; pgsql-sql
On Thu, 18 May 2006 06:44:55 -0600
Michael Fuhr <mike@fuhr.org> wrote:
> On Thu, May 18, 2006 at 04:21:19AM -0700, Thusitha Kodikara wrote:
> > Are there any encryption functions that can be used in
> > SQL inserts and selects directly? For example like
> > "select encryptin_function('test_to_be_encrypted'), ........"
>
> See the contrib/pgcrypto module. It has functions like digest()
> for making SHA1, MD5, and other digests; hmac() for making Hashed
> Message Authentication Codes; and encrypt()/encrypt_iv() and
> decrypt()/decrypt_iv() for doing encryption and decryption. Since
> 8.1 pgcrypto also has functions for doing OpenPGP symmetric and
> public-key encryption.
If your requirements are simpler check out the genpass module. It is a
DES3 encrypted type. You can do things like "SELECT * FROM table WHERE
passw = 'hello'" and it will find passwords that are entered as 'hello'
even though they are stored encrypted. Example:
darcy=# select 'hello'::chkpass;
chkpass
----------------
:v1L3NdWy0OHlQ
(1 row)
darcy=# select ':v1L3NdWy0OHlQ'::chkpass = 'hello';
?column?
----------
t
(1 row)
darcy=# select ':v1L3NdWy0OHlQ'::chkpass = 'nothello';
?column?
----------
f
(1 row)
Note that the leading colon says that the string is already encrypted.
This allows dump and restore to work correctly.
--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Encryption functions
2006-05-18 11:21 Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
2006-05-18 12:44 ` Re: Encryption functions Michael Fuhr <mike@fuhr.org>
2006-05-18 13:13 ` Re: Encryption functions D'Arcy J.M. Cain <darcy@druid.net>
@ 2006-05-18 13:41 ` D'Arcy J.M. Cain <darcy@druid.net>
1 sibling, 0 replies; 6+ messages in thread
From: D'Arcy J.M. Cain @ 2006-05-18 13:41 UTC (permalink / raw)
To: D'Arcy J.M. Cain <darcy@druid.net>; +Cc: mike@fuhr.org; kthusi@yahoo.com; pgsql-sql
On Thu, 18 May 2006 09:13:39 -0400
"D'Arcy J.M. Cain" <darcy@druid.net> wrote:
> If your requirements are simpler check out the genpass module. It is a
Sorry, chkpass module.
--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Encryption functions
2006-05-18 11:21 Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
2006-05-18 12:44 ` Re: Encryption functions Michael Fuhr <mike@fuhr.org>
2006-05-18 13:13 ` Re: Encryption functions D'Arcy J.M. Cain <darcy@druid.net>
@ 2006-05-19 02:55 ` Thusitha Kodikara <kthusi@yahoo.com>
1 sibling, 0 replies; 6+ messages in thread
From: Thusitha Kodikara @ 2006-05-19 02:55 UTC (permalink / raw)
To: D'Arcy J.M. Cain <darcy@druid.net>; Michael Fuhr <mike@fuhr.org>; +Cc: kthusi@yahoo.com; pgsql-sql
Thanks for the guidance .
-Thusitha
"D'Arcy J.M. Cain" <darcy@druid.net> wrote: On Thu, 18 May 2006 06:44:55 -0600
Michael Fuhr wrote:
> On Thu, May 18, 2006 at 04:21:19AM -0700, Thusitha Kodikara wrote:
> > Are there any encryption functions that can be used in
> > SQL inserts and selects directly? For example like
> > "select encryptin_function('test_to_be_encrypted'), ........"
>
> See the contrib/pgcrypto module. It has functions like digest()
> for making SHA1, MD5, and other digests; hmac() for making Hashed
> Message Authentication Codes; and encrypt()/encrypt_iv() and
> decrypt()/decrypt_iv() for doing encryption and decryption. Since
> 8.1 pgcrypto also has functions for doing OpenPGP symmetric and
> public-key encryption.
If your requirements are simpler check out the genpass module. It is a
DES3 encrypted type. You can do things like "SELECT * FROM table WHERE
passw = 'hello'" and it will find passwords that are entered as 'hello'
even though they are stored encrypted. Example:
darcy=# select 'hello'::chkpass;
chkpass
----------------
:v1L3NdWy0OHlQ
(1 row)
darcy=# select ':v1L3NdWy0OHlQ'::chkpass = 'hello';
?column?
----------
t
(1 row)
darcy=# select ':v1L3NdWy0OHlQ'::chkpass = 'nothello';
?column?
----------
f
(1 row)
Note that the leading colon says that the string is already encrypted.
This allows dump and restore to work correctly.
--
D'Arcy J.M. Cain | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Encryption functions
2006-05-18 11:21 Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
2006-05-18 12:44 ` Re: Encryption functions Michael Fuhr <mike@fuhr.org>
@ 2006-05-19 02:43 ` Thusitha Kodikara <kthusi@yahoo.com>
1 sibling, 0 replies; 6+ messages in thread
From: Thusitha Kodikara @ 2006-05-19 02:43 UTC (permalink / raw)
To: Michael Fuhr <mike@fuhr.org>; +Cc: pgsql-sql
Thanks Michael, I'll check that module.
Michael Fuhr <mike@fuhr.org> wrote: On Thu, May 18, 2006 at 04:21:19AM -0700, Thusitha Kodikara wrote:
> Are there any encryption functions that can be used in
> SQL inserts and selects directly? For example like
> "select encryptin_function('test_to_be_encrypted'), ........"
See the contrib/pgcrypto module. It has functions like digest()
for making SHA1, MD5, and other digests; hmac() for making Hashed
Message Authentication Codes; and encrypt()/encrypt_iv() and
decrypt()/decrypt_iv() for doing encryption and decryption. Since
8.1 pgcrypto also has functions for doing OpenPGP symmetric and
public-key encryption.
--
Michael Fuhr
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2006-05-19 02:55 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-18 11:21 Encryption functions Thusitha Kodikara <kthusi@yahoo.com>
2006-05-18 12:44 ` Michael Fuhr <mike@fuhr.org>
2006-05-18 13:13 ` D'Arcy J.M. Cain <darcy@druid.net>
2006-05-18 13:41 ` D'Arcy J.M. Cain <darcy@druid.net>
2006-05-19 02:55 ` Thusitha Kodikara <kthusi@yahoo.com>
2006-05-19 02:43 ` Thusitha Kodikara <kthusi@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox