README.md
1# pg_ed25519
2
3Version: 0.2
4
5**pg_ed25519** is a PostgreSQL extension for signing and verify signatures via ed25519 algorithm.
6
7**pg_ed25519** is released under the MIT license (See LICENSE file).
8
9### Version Compatability
10This code is built with the following assumptions. You may get mixed results if you deviate from these versions.
11
12* [PostgreSQL](http://www.postgresql.org) 9.4+
13
14### Requirements
15* PostgreSQL
16
17### Building
18
19To build you will need to install PostgreSQL server development packages.
20On Debian based distributions you can usually do something like this:
21
22 apt-get install -y postgresql-server-dev-all
23
24If you have all of the prerequisites installed you should be able to just:
25
26 make && make install
27
28### Usage
29Generate ed25519 keys via openssl:
30
31 openssl genpkey -algorithm ed25519 -outform PEM -out test25519.pem
32
33Extract private key, base64 encoded:
34
35 openssl pkey -outform DER -in test25519.pem | tail -c +17 | head -c 32 | openssl base64
36
37For example it will be
38
39 eT7qaT8vkIgCl6/9EmEDYYEgxA0oOgHc0P6UYzcQN28=
40
41Extract public key, base64 encoded:
42
43 openssl pkey -outform DER -pubout -in test25519.pem | tail -c +13 | head -c 32 | openssl base64
44
45For example it will be
46
47 NZV4l8hck3iUqInENyI+nn5vkW7rqzQg0uiuuZkPnHE=
48
49Open pgsql console
50
51```sql
52SELECT ed25519.verify(
53 text 'some data for signing',
54 ed25519.sign(
55 text 'some data for signing',
56 decode('NZV4l8hck3iUqInENyI+nn5vkW7rqzQg0uiuuZkPnHE=', 'base64'),
57 decode('eT7qaT8vkIgCl6/9EmEDYYEgxA0oOgHc0P6UYzcQN28=', 'base64')
58 ),
59 decode('NZV4l8hck3iUqInENyI+nn5vkW7rqzQg0uiuuZkPnHE=', 'base64')
60 );
61```
62
63Result should be
64
65 verify
66 --------
67 t
68 (1 row)
69
70### Support
71
72File bug reports, feature requests and questions using
73[GitLab Issues](https://gitlab.com/dwagin/pg_ed25519/issues)
74
75