CVS log for pgsql/contrib/pgcrypto/pgcrypto.sql.in

[BACK] Up to [PostgreSQL CVS Repository] / pgsql / contrib / pgcrypto

Request diff between arbitrary revisions - Display revisions graphically


Keyword substitution: kv
Default branch: MAIN


Revision 1.16: download - view: text, markup, annotated - select for diffs
Thu Aug 19 05:57:33 2010 UTC (20 months, 3 weeks ago) by petere
Branches: MAIN
CVS tags: REL9_1_ALPHA1, HEAD
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +1 -2 lines
Remove extra newlines at end and beginning of files, add missing newlines
at end of files.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Tue Nov 13 04:24:28 2007 UTC (4 years, 6 months ago) by momjian
Branches: MAIN
CVS tags: REL9_0_STABLE, REL9_0_RC1, REL9_0_BETA4, REL9_0_BETA3, REL9_0_BETA2, REL9_0_BETA1, REL9_0_ALPHA5_BRANCH, REL9_0_ALPHA5, REL9_0_ALPHA4_BRANCH, REL9_0_ALPHA4, REL9_0_0, REL8_5_ALPHA3_BRANCH, REL8_5_ALPHA3, REL8_5_ALPHA2_BRANCH, REL8_5_ALPHA2, REL8_5_ALPHA1_BRANCH, REL8_5_ALPHA1, REL8_4_STABLE, REL8_4_RC2, REL8_4_RC1, REL8_4_BETA2, REL8_4_BETA1, REL8_4_4, REL8_4_3, REL8_4_2, REL8_4_1, REL8_4_0, REL8_3_STABLE, REL8_3_RC2, REL8_3_RC1, REL8_3_BETA4, REL8_3_BETA3, REL8_3_9, REL8_3_8, REL8_3_7, REL8_3_6, REL8_3_5, REL8_3_4, REL8_3_3, REL8_3_2, REL8_3_11, REL8_3_10, REL8_3_1, REL8_3_0
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +2 -0 lines
Add CVS version labels to all install/uninstall scripts.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Tue Sep 5 21:26:48 2006 UTC (5 years, 8 months ago) by tgl
Branches: MAIN
CVS tags: REL8_3_BETA2, REL8_3_BETA1, REL8_2_STABLE, REL8_2_RC1, REL8_2_BETA3, REL8_2_BETA2, REL8_2_BETA1, REL8_2_9, REL8_2_8, REL8_2_7, REL8_2_6, REL8_2_5, REL8_2_4, REL8_2_3, REL8_2_2, REL8_2_17, REL8_2_16, REL8_2_15, REL8_2_14, REL8_2_13, REL8_2_12, REL8_2_11, REL8_2_10, REL8_2_1, REL8_2_0
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +0 -15 lines
Remove pgcrypto functions that were deprecated and slated for removal.
Marko Kreen

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Jul 13 04:15:25 2006 UTC (5 years, 10 months ago) by neilc
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +5 -0 lines
"Annual" pgcrypto update from Marko Kreen:

Few cleanups and couple of new things:

 - add SHA2 algorithm to older OpenSSL
 - add BIGNUM math to have public-key cryptography work on non-OpenSSL
   build.
 - gen_random_bytes() function

The status of SHA2 algoritms and public-key encryption can now be
changed to 'always available.'

That makes pgcrypto functionally complete and unless there will be new
editions of AES, SHA2 or OpenPGP standards, there is no major changes
planned.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Mon Feb 27 16:09:49 2006 UTC (6 years, 2 months ago) by petere
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +35 -35 lines
Clean up CREATE FUNCTION syntax usage in contrib and elsewhere, in
particular get rid of single quotes around language names and old WITH ()
construct.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Jul 10 03:57:55 2005 UTC (6 years, 10 months ago) by momjian
Branches: MAIN
CVS tags: REL8_1_STABLE, REL8_1_9, REL8_1_8, REL8_1_7, REL8_1_6, REL8_1_5, REL8_1_4, REL8_1_3, REL8_1_21, REL8_1_20, REL8_1_2, REL8_1_19, REL8_1_18, REL8_1_17, REL8_1_16, REL8_1_15, REL8_1_14, REL8_1_13, REL8_1_12, REL8_1_11, REL8_1_10, REL8_1_1, REL8_1_0RC1, REL8_1_0BETA4, REL8_1_0BETA3, REL8_1_0BETA2, REL8_1_0BETA1, REL8_1_0
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +137 -0 lines
Major pgcrypto changes:

of password-based encryption from RFC2440 (OpenPGP).

The goal of this code is to be more featureful encryption solution
than current encrypt(), which only functionality is running cipher
over data.

Compared to encrypt(), pgp_encrypt() does following:

* It uses the equvialent of random Inital Vector to get cipher
  into random state before it processes user data
* Stores SHA-1 of the data into result so any modification
  will be detected.
* Remembers if data was text or binary - thus it can decrypt
  to/from text data.  This was a major nuisance for encrypt().
* Stores info about used algorithms with result, so user needs
  not remember them - more user friendly!
* Uses String2Key algorithms (similar to crypt()) with random salt
  to generate full-length binary key to be used for encrypting.
* Uses standard format for data - you can feed it to GnuPG, if needed.

Optional features (off by default):

* Can use separate session key - user data will be encrypted
  with totally random key, which will be encrypted with S2K
  generated key and attached to result.
* Data compression with zlib.
* Can convert between CRLF<->LF line-endings - to get fully
  RFC2440-compliant behaviour.  This is off by default as
  pgcrypto does not know the line-endings of user data.

Interface is simple:


    pgp_encrypt(data text, key text) returns bytea
    pgp_decrypt(data text, key text) returns text
    pgp_encrypt_bytea(data bytea, key text) returns bytea
    pgp_decrypt_bytea(data bytea, key text) returns bytea

To change parameters (cipher, compression, mdc):

    pgp_encrypt(data text, key text, parms text) returns bytea
    pgp_decrypt(data text, key text, parms text) returns text
    pgp_encrypt_bytea(data bytea, key text, parms text) returns bytea
    pgp_decrypt_bytea(data bytea, key text, parms text) returns bytea

Parameter names I lifted from gpg:

   pgp_encrypt('message', 'key', 'compress-algo=1,cipher-algo=aes256')

For text data, pgp_encrypt simply encrypts the PostgreSQL internal data.

This maps to RFC2440 data type 't' - 'extenally specified encoding'.
But this may cause problems if data is dumped and reloaded into database
which as different internal encoding.  My next goal is to implement data
type 'u' - which means data is in UTF-8 encoding by converting internal
encoding to UTF-8 and back.  And there wont be any compatibility
problems with current code, I think its ok to submit this without UTF-8
encoding by converting internal encoding to UTF-8 and back.  And there
wont be any compatibility problems with current code, I think its ok to
submit this without UTF-8 support.


Here is v4 of PGP encrypt.  This depends on previously sent
Fortuna-patch, as it uses the px_add_entropy function.

- New function: pgp_key_id() for finding key id's.
- Add SHA1 of user data and key into RNG pools.  We need to get
  randomness from somewhere, and it is in user best interests
  to contribute.
- Regenerate pgp-armor test for SQL_ASCII database.
- Cleanup the key handling so that the pubkey support is less
  hackish.

Marko Kreen

Revision 1.10: download - view: text, markup, annotated - select for diffs
Fri Jul 8 04:27:49 2005 UTC (6 years, 10 months ago) by neilc
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +14 -14 lines
This patch updates the DDL for contrib/pgcrypto to create all
functions as STRICT, and all functions except gen_salt() as IMMUTABLE.
gen_salt() is VOLATILE.

Although the functions are now STRICT, I left their PG_ARGISNULL()
checks in place as a protective measure for users who install the
new code but use old (non-STRICT) catalog entries (e.g., restored
from a dump).  Per recent discussion in pgsql-hackers.

Patch from Michael Fuhr.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Wed May 14 03:25:56 2003 UTC (9 years ago) by tgl
Branches: MAIN
CVS tags: WIN32_DEV, REL8_0_STABLE, REL8_0_9, REL8_0_8, REL8_0_7, REL8_0_6, REL8_0_5, REL8_0_4, REL8_0_3, REL8_0_25, REL8_0_24, REL8_0_23, REL8_0_22, REL8_0_21, REL8_0_20, REL8_0_2, REL8_0_19, REL8_0_18, REL8_0_17, REL8_0_16, REL8_0_15, REL8_0_14, REL8_0_13, REL8_0_12, REL8_0_11, REL8_0_10, REL8_0_1, REL8_0_0RC5, REL8_0_0RC4, REL8_0_0RC3, REL8_0_0RC2, REL8_0_0RC1, REL8_0_0BETA5, REL8_0_0BETA4, REL8_0_0BETA3, REL8_0_0BETA2, REL8_0_0BETA1, REL8_0_0, REL7_4_STABLE, REL7_4_RC2, REL7_4_RC1, REL7_4_BETA5, REL7_4_BETA4, REL7_4_BETA3, REL7_4_BETA2, REL7_4_BETA1, REL7_4_9, REL7_4_8, REL7_4_7, REL7_4_6, REL7_4_5, REL7_4_4, REL7_4_3, REL7_4_29, REL7_4_28, REL7_4_27, REL7_4_26, REL7_4_25, REL7_4_24, REL7_4_23, REL7_4_22, REL7_4_21, REL7_4_20, REL7_4_2, REL7_4_19, REL7_4_18, REL7_4_17, REL7_4_16, REL7_4_15, REL7_4_14, REL7_4_13, REL7_4_12, REL7_4_11, REL7_4_10, REL7_4_1, REL7_4
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +0 -2 lines
Backend support for autocommit removed, per recent discussions.  The
only remnant of this failed experiment is that the server will take
SET AUTOCOMMIT TO ON.  Still TODO: provide some client-side autocommit
logic in libpq.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Fri Oct 18 18:41:20 2002 UTC (9 years, 6 months ago) by momjian
Branches: MAIN
CVS tags: REL7_3_STABLE, REL7_3_9, REL7_3_8, REL7_3_7, REL7_3_6, REL7_3_5, REL7_3_4, REL7_3_21, REL7_3_20, REL7_3_2, REL7_3_19, REL7_3_18, REL7_3_17, REL7_3_16, REL7_3_15, REL7_3_14, REL7_3_13, REL7_3_12, REL7_3_11, REL7_3_10
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +73 -72 lines
Update /contrib for "autocommit TO 'on'".

Create objects in public schema.

Make spacing/capitalization consistent.

Remove transaction block use for object creation.

Remove unneeded function GRANTs.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Jan 7 18:56:09 2002 UTC (10 years, 4 months ago) by tgl
Branches: MAIN
CVS tags: REL7_2_STABLE, REL7_2_RC2, REL7_2_RC1, REL7_2_BETA5, REL7_2_8, REL7_2_7, REL7_2_6, REL7_2_5, REL7_2_4, REL7_2_3, REL7_2
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +10 -0 lines
Add variants of digest() and hmac() that accept text inputs.
 Marko Kreen says:
This is so obvious that I would like to make it 'official'.

Seems like the theology around bytea<>text casting kept me from
seeing the simple :)

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sat Sep 29 03:11:58 2001 UTC (10 years, 7 months ago) by momjian
Branches: MAIN
CVS tags: REL7_2_BETA4, REL7_2_BETA3, REL7_2_BETA2, REL7_2_BETA1
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +12 -12 lines
I noticed that the contrib Makefiles were reorganized.
Converted pgcrypto one too.

* Changed default randomness source to libc random()
  That way pgcrypto does not have any external dependencies
  and should work everywhere.
* Re-enabled pgcrypto build in contrib/makefile
* contrib/README update - there is more stuff than
  only 'hash functions'
* Noted the libc random fact in README.pgcrypto


Marko Kreen

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Sep 23 04:12:44 2001 UTC (10 years, 7 months ago) by momjian
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +6 -0 lines
Big thanks to Solar Designer who pointed out a bug in bcrypt
salt generation code.  He also urged using better random source
and making possible to choose using bcrypt and xdes rounds more
easily.  So, here's patch:

* For all salt generation, use Solar Designer's own code.  This
  is mostly due fact that his code is more fit for get_random_bytes()
  style interface.
* New function: gen_salt(type, rounds).  This lets specify iteration
  count for algorithm.
* random.c: px_get_random_bytes() function.
  Supported randomness soure: /dev/urandom, OpenSSL PRNG, libc random()
  Default: /dev/urandom.
* Draft description of C API for pgcrypto functions.

New files: API, crypt-gensalt.c, random.c

Marko Kreen

Revision 1.4: download - view: text, markup, annotated - select for diffs
Tue Aug 21 00:42:41 2001 UTC (10 years, 8 months ago) by momjian
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +46 -10 lines
/contrib/pgcrypto:

* remove support for encode() as it is in main tree now
* remove krb5.c
* new 'PX library' architecture
* remove BSD license from my code to let the general
  PostgreSQL one to apply
* md5, sha1: ANSIfy, use const where appropriate
* various other formatting and clarity changes
* hmac()
* UN*X-like crypt() - system or internal crypt
* Internal crypt: DES, Extended DES, MD5, Blowfish
  crypt-des.c, crypt-md5.c from FreeBSD
  crypt-blowfish.c from Solar Designer
* gen_salt() for crypt() -  Blowfish, MD5, DES, Extended DES
* encrypt(), decrypt(), encrypt_iv(), decrypt_iv()
* Cipher support in mhash.c, openssl.c
* internal: Blowfish, Rijndael-128 ciphers
* blf.[ch], rijndael.[ch] from OpenBSD
* there will be generated file rijndael-tbl.inc.

Marko Kreen

Revision 1.3: download - view: text, markup, annotated - select for diffs
Wed Jan 24 03:46:16 2001 UTC (11 years, 3 months ago) by momjian
Branches: MAIN
CVS tags: REL7_1_STABLE, REL7_1_2, REL7_1
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +11 -0 lines
I would like to do a interface change in pgcrypto.  (Good
timing, I know :))  At the moment the digest() function returns
hexadecimal coded hash, but I want it to return pure binary.  I
have also included functions encode() and decode() which support
'base64' and 'hex' encodings, so if anyone needs digest() in hex
he can do encode(digest(...), 'hex').

Main reason for it is "to do one thing and do it well" :)

Another reason is if someone needs really lot of digesting, in
the end he wants to store the binary not the hexadecimal result.
It is really silly to convert it to hex then back to binary
again.  As I said if someone needs hex he can get it.

Well, and the real reason that I am doing encrypt()/decrypt()
functions and _they_ return binary.  For testing I like to see
it in hex occasionally, but it is really wrong to let them
return hex.  Only now it caught my eye that hex-coding in
digest() is wrong.  When doing digest() I thought about 'common
case' but hacking with psql is probably _not_ the common case :)

Marko Kreen

Revision 1.2: download - view: text, markup, annotated - select for diffs
Mon Nov 20 20:36:56 2000 UTC (11 years, 5 months ago) by tgl
Branches: MAIN
CVS tags: REL7_1_BETA3, REL7_1_BETA2, REL7_1_BETA
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +2 -2 lines
Revise handling of oldstyle/newstyle functions per recent discussions
in pghackers list.  Support for oldstyle internal functions is gone
(no longer needed, since conversion is complete) and pg_language entry
'internal' now implies newstyle call convention.  pg_language entry
'newC' is gone; both old and newstyle dynamically loaded C functions
are now called language 'C'.  A newstyle function must be identified
by an associated info routine.  See src/backend/utils/fmgr/README.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue Oct 31 13:11:28 2000 UTC (11 years, 6 months ago) by petere
Branches: MAIN
Hashing functions from Marko Kreen <marko@l-t.ee>

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

PostgreSQL CVSweb <webmaster@postgresql.org>