pg_ed25519
Ed25519 signing and signature-verification functions for PostgreSQL
pg_ed25519 · Ed25519 signing and signature-verification functions for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100180 | pg_ed25519 | pg_ed25519 | 0.2 | SEC | MIT | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
- Official README at the catalog revision
- Extension SQL at the catalog revision
- Implementation at the catalog revision
pg_ed25519 0.2 adds Ed25519 signing and verification functions in the fixed ed25519 schema. It accepts raw 32-byte public and private keys and produces 64-byte signatures. It provides cryptographic operations only, not key generation, storage, rotation, or access control.
Core Workflow
Generate keys outside PostgreSQL, retain the raw 32-byte key material described by upstream, and pass it as bound bytea parameters rather than SQL literals.
The signing parameter order is message, public key, private key. Verification takes message, signature, public key.
Function Index
ed25519.sign(bytea, bytea, bytea)and its text-message overload return a 64-byte signature.ed25519.verify(bytea, bytea, bytea)and its text-message overload return boolean.- The functions are immutable, strict, and parallel-safe. Invalid key or signature lengths raise errors.
Security and Interoperability
- Private key bytes cross the SQL boundary. Protect them from query text, logs, statistics, tracing, result capture, and roles that can inspect sessions; prefer application-side signing when that exposure is unacceptable.
- Text overloads sign the exact server-encoded text bytes. Use bytea with an explicitly canonicalized encoding when other systems must reproduce signatures.
- The extension is installed into the fixed ed25519 schema and is not relocatable. Schema-qualify calls and tightly control EXECUTE privileges.