Format-preserving encryption UDFs for Trino.
Built on io.cyphera:cyphera from Maven Central.
docker compose up -d
# Wait for Trino to start (~30s)
trino http://localhost:8080 < demo.sqlSee DEMO.md for the full walkthrough with verified input/output.
mvn package -DskipTestsProduces target/cyphera-trino-0.1.0.jar (fat JAR with all dependencies).
docker build -t cyphera-trino .- Copy the fat JAR to
$TRINO_HOME/plugin/cyphera/:mkdir -p /usr/lib/trino/plugin/cyphera cp target/cyphera-trino-0.1.0.jar /usr/lib/trino/plugin/cyphera/
- Place configuration file at
/etc/cyphera/cyphera.json(or setCYPHERA_CONFIGURATION_FILEenv var) - Restart Trino
The plugin auto-registers cyphera_protect and cyphera_access functions on startup.
-- Protect with a named configuration
SELECT cyphera_protect('ssn', '123-45-6789');
-- → 'T01i6J-xF-07pX' (header-prefixed, dashes preserved)
-- Access — the embedded header tells Cyphera which configuration to use; no name needed
SELECT cyphera_access(cyphera_protect('ssn', '123-45-6789'));
-- → '123-45-6789'
-- Bulk protect
SELECT name, cyphera_protect('ssn', ssn) AS protected_ssn
FROM customers;- Configuration file:
/etc/cyphera/cyphera.json(override withCYPHERA_CONFIGURATION_FILEenv var) - Configuration changes require a Trino restart (the plugin loads at startup)
- Errors return
[error: message]as the function output instead of failing the query - Check Trino server logs for
CypheraLoaderentries on startup
- Build a new JAR with the updated SDK version in
pom.xml - Replace the JAR in
$TRINO_HOME/plugin/cyphera/ - Restart Trino
- "Unknown configuration" — configuration name doesn't match cyphera.json. Check file path and contents.
- "Unknown key" —
key_refin a configuration doesn't match a key in thekeyssection. - Function not found — JAR not in the plugin directory, or Trino hasn't been restarted.
{
"configurations": {
"ssn": { "engine": "ff1", "key_ref": "demo-key", "header": "T01" },
"credit_card": { "engine": "ff1", "key_ref": "demo-key", "header": "T02" },
"name": { "engine": "ff1", "alphabet": "alpha_lower", "key_ref": "demo-key", "header": "T03" }
},
"keys": {
"demo-key": { "material": "2B7E151628AED2A6ABF7158809CF4F3C" }
}
}- Aggregate functions (protect/access across result sets)
- Dynamic configuration reload without restart
- Trino connector for configuration metadata discovery
Apache 2.0 — Copyright 2026 Horizon Digital Engineering LLC