pguecc
pguecc
pg_ecdsa : uECC bindings for Postgres
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4460 | pguecc
|
pg_ecdsa
|
1.0 |
UTIL
|
BSD 2-Clause
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | hashlib
shacrypt
cryptint
pgcrypto
gzip
bzip
zstd
http
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
1.0 |
18
17
16
15
14
|
pg_ecdsa |
- |
| RPM | PIGSTY
|
1.0 |
18
17
16
15
14
|
pg_ecdsa_$v |
- |
| DEB | PIGSTY
|
1.0 |
18
17
16
15
14
|
postgresql-$v-pg-ecdsa |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el8.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el9.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el9.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el10.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el10.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d12.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d12.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d13.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d13.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u22.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u22.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u24.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u24.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
Source
pig build pkg pg_ecdsa; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_ecdsa; # install via package name, for the active PG version
pig install pguecc; # install by extension name, for the current active PG version
pig install pguecc -v 18; # install for PG 18
pig install pguecc -v 17; # install for PG 17
pig install pguecc -v 16; # install for PG 16
pig install pguecc -v 15; # install for PG 15
pig install pguecc -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pguecc;Usage
pguecc: Elliptic curve cryptography (micro-ecc bindings) for PostgreSQL
Requires the pgcrypto extension.
Generate Key Pair
SELECT ecdsa_make_key('secp256k1');
-- (public_key_hex, private_key_hex)Sign Data
SELECT ecdsa_sign(
'000000000000000000000000000000000000000000', -- private key (hex)
'1234', -- data to sign
'sha256', -- hash function
'secp160r1' -- curve name
);Verify Signature
SELECT ecdsa_verify(
'<public_key_hex>',
'hello, world',
'<signature_hex>',
'sha256',
'secp256k1'
);
-- tKey Validation
SELECT ecdsa_is_valid_public_key('<public_key_hex>', 'secp256k1');
SELECT ecdsa_is_valid_private_key('<private_key_hex>', 'secp256k1');
SELECT ecdsa_is_valid_curve('secp256k1'); -- trueSupported Curves
secp160r1, secp192r1, secp224r1, secp256r1, secp256k1
Raw API
For direct signing without hashing (use with caution):
SELECT ecdsa_sign_raw(private_key_bytea, hash_bytea, 'secp256k1');
SELECT ecdsa_verify_raw(public_key_bytea, hash_bytea, signature_bytea, 'secp256k1');Last updated on