Using Encryption

» SQLcrypt™

SQLcrypt™ performs its cryptography transparently at the storage level. You do not need to filter your data through proprietary, nonportable SQL functions.

SQLcrypt™'s AES cipher key is derived from the user-supplied passphrase using PKCS #5. A passphrase may be between 8 and 128 characters long.

» MySQL

From the MySQL manual, MySQL provides the SQL functions AES_ENCRYPT() and AES_DECRYPT(). Cipher key length is fixed at 128 bits; to change, modify the source code. Here is an example on its usage:

INSERT INTO t VALUES (1, AES_ENCRYPT('text', 'password'));

The manual does not explain how the key string "password" is transformed into a 128-bit cipher key.

» PostgreSQL

PostgreSQL bundles a contributed module called "pgcrypto" which provides AES and other ciphers, accessible through the SQL functions encrypt() and decrypt(). Here is an example; the cipher key is the second argument ("000102030...1a1b") to encrypt().

SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b', 'hex'),
'aes-cbc'), 'hex');

It is up to the programmer to provide the cipher key.