Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cossacklabs/pg_themis
Postgres Themis plugin
https://github.com/cossacklabs/pg_themis
cryptography encrypted-data encryption postgresql
Last synced: 2 months ago
JSON representation
Postgres Themis plugin
- Host: GitHub
- URL: https://github.com/cossacklabs/pg_themis
- Owner: cossacklabs
- License: apache-2.0
- Created: 2016-11-01T10:48:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-12T16:07:59.000Z (about 8 years ago)
- Last Synced: 2024-07-20T03:47:41.069Z (6 months ago)
- Topics: cryptography, encrypted-data, encryption, postgresql
- Language: C
- Homepage: https://www.cossacklabs.com/themis/
- Size: 13.7 KB
- Stars: 30
- Watchers: 15
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PG_Themis
Postgres Themis plugin=======
pg_themis is a PostgreSQL extension for encrypting/decrypting data using the [Themis](https://github.com/cossacklabs/themis) library. Requires PostgreSQL version 9.1 or later.
## Building and installing PG_Themis
Requirements:
to build and install PG_Themis [themis](https://github.com/cossacklabs/themis) must be installed to sysytemTo build and install PG_Themis:
```
make
make install
```Once PG_Themis is installed, you can add it to a database:
```
CREATE EXTENSION pg_themis;
```## PG_Themis functions
The extension adds four functions `pg_themis_scell_encrypt_seal`, `pg_themis_scell_decrypt_seal`, `pg_themis_smessage_encrypt`, `pg_themis_smessage_decrypt`, which expose encryption decryption of [Secure Cell](https://github.com/cossacklabs/themis/wiki/Secure-Cell-cryptosystem) in Seal mode and [Secure Cell](https://github.com/cossacklabs/themis/wiki/Secure-Cell-cryptosystem) wrapped in [Secure Message](https://github.com/cossacklabs/themis/wiki/Secure-Message-cryptosystem) with random public key:
```SQL
-- Encrypts data with key.
CREATE FUNCTION pg_themis_scell_encrypt_seal(data bytea, key bytea)
RETURNS bytea
AS 'pg_themis', 'pg_themis_scell_encrypt_seal' LANGUAGE c STRICT;-- Decrypts data with key.
CREATE FUNCTION pg_themis_scell_decrypt_seal(encrypted_data bytea, key bytea)
RETURNS bytea
AS 'pg_themis', 'pg_themis_scell_decrypt_seal' LANGUAGE c STRICT;-- Encrypts data with public key.
CREATE FUNCTION pg_themis_smessage_encrypt(plain_data bytea, public_key bytea)
RETURNS bytea
AS 'pg_themis', 'pg_themis_smessage_encrypt' LANGUAGE c STRICT;-- Decrypts data with private_key.
CREATE FUNCTION pg_themis_smessage_decrypt(encrypted_data bytea, private_key bytea)
RETURNS bytea
AS 'pg_themis', 'pg_themis_smessage_decrypt' LANGUAGE c STRICT;
```