Go to file
Bruce Momjian 73e2431817 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
2005-07-10 03:57:55 +00:00
config Update to autoconf 2.59 as well as updates of related scripts 2005-07-01 18:17:31 +00:00
contrib Major pgcrypto changes: 2005-07-10 03:57:55 +00:00
doc Add psql \pset numericsep to allow output numbers like 100,000.0 or 2005-07-10 03:46:13 +00:00
src Add psql \pset numericsep to allow output numbers like 100,000.0 or 2005-07-10 03:46:13 +00:00
COPYRIGHT Tag appropriate files for rc3 2004-12-31 22:04:05 +00:00
GNUmakefile.in Remove the contents of the src/corba subdirectory: this has been dead code 2005-05-01 06:15:51 +00:00
Makefile please find attached an alternate submission which addresses open item 2004-10-06 08:50:02 +00:00
README Remove more traces of libpgtcl from the source tree. Also, make some 2004-10-01 02:00:44 +00:00
README.CVS Some further editorializing on README.CVS. 2004-03-28 06:09:08 +00:00
aclocal.m4 Add new auto-detection of thread flags. 2004-04-23 18:15:55 +00:00
configure Reverse out because the lack of using pgport in timezone/ is causing 2005-07-06 21:04:14 +00:00
configure.in Reverse out because the lack of using pgport in timezone/ is causing 2005-07-06 21:04:14 +00:00

README

PostgreSQL Database Management System
=====================================
  
This directory contains the source code distribution of the PostgreSQL
database management system.

PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, user-defined types
and functions.  This distribution also contains C language bindings.

The JDBC, ODBC, C++, Python, and Tcl interfaces have been moved to the
PostgreSQL Projects Web Site at http://gborg.postgresql.org for separate
maintenance.  A Perl DBI/DBD driver is available from CPAN.

See the file INSTALL for instructions on how to build and install
PostgreSQL.  That file also lists supported operating systems and
hardware platforms and contains information regarding any other
software packages that are required to build or run the PostgreSQL
system.  Changes between all PostgreSQL releases are recorded in the
file HISTORY.  Copyright and license information can be found in the
file COPYRIGHT.  A comprehensive documentation set is included in this
distribution; it can be read as described in the installation
instructions.

The latest version of this software may be obtained at
ftp://ftp.postgresql.org/pub/.  For more information look at our web
site located at http://www.postgresql.org/.