From the archive to the first encrypted value

UAESGP encrypts a database column, the whole JSON body of an API request or response, values coming from browser and mobile apps, and data sent to partners. This page has the code for each path. Every SDK method, command and setting has been compared with the product source. Next to each one it says which ran on a real server and which exists only in tests or only in code. Status: 19 November 2026.

If no mail app opens, write to this address: ogabekkadirov.dev@gmail.com

Node.js: writing a value
// the plaintext value goes to the EG over TLS, and an envelope comes back
const env = await client.encrypt('+998901234567', 'pii.phone', { aadExtra: binding });
await db.query('UPDATE customers SET phone = $1 WHERE id = 42', [env.toJson()]);
What the customers.phone column holds
{"v":"1","alg":"AES-256-GCM","tenant_id":"kompaniya-a","domain":"pii.phone","key_version":3,"iv":"9a46a9870d9af566ab467362","ciphertext":"DWyNuItRKjVdAmsQIg==","auth_tag":"vwUEkg5r8BKkcRDn7v9stQ==", …}

Tested on a clean server This flow has run on a clean server with Node.js. The envelope of a 13-byte value is 699 bytes (measured with envelope.Seal). The sample is shortened here; the full one is in the REST section.

12 SDKs in 10 languagesAs source code in the archive's sdks/ folder. Not in any public registry.
2 SDKs have touched a real EGNode.js and Go. The others are tested against a test server or have not been run yet.
13 bytes become 699 bytesYou change the column type and length.
No filtering on an encrypted columnWHERE, ORDER BY, JOIN and unique indexes do not work.

The plaintext value travels between the application and the EG; only the envelope is written to the database

The EG (Encryption Gateway) is a service on your server. The application sends it a value, and it returns an envelope. An envelope is JSON that holds the encrypted text and its cleartext metadata. A separate service, the KMS, stores the keys. The whole API body, browser and partner paths follow the same model: an envelope goes to the database and over the wire, and the plaintext value exists in the application that sent it, in the EG and in the application allowed to decrypt it.

The diagram continues to the right: scroll sideways →

Your application SDK and certificate has the plaintext plaintext, TLS envelope EG encryption gateway plaintext only during a request key KMS keys does not see the data envelope is written Database envelope, no key If a database copy is stolen, protected columns show only the envelope. Decryption reverses the path: the envelope goes to EG, and the plaintext returns to the application over TLS.
The application, EG, KMS and database run in your infrastructure. Encryption is performed in the EG, not inside the application: the plaintext value reaches the EG inside TLS and exists there during the request. Orange marks where a plaintext value is present; teal marks the envelope and keys. More on the components: Platform.

13 steps to the first encrypted value: 9 for the administrator, 4 for the developer

The examples use tenant kompaniya-a, domain pii.phone and the EG internal address https://10.0.0.5:8444. Replace these values with your own.

Tested on a clean server These 13 steps have passed with Node.js on a clean Ubuntu 24.04 arm64 server. A physical or virtual amd64 server and RHEL are not yet tested. How long the application part takes has not been measured.

  1. Administrator

    Prepare the server

    Linux, Docker, Compose 2.24.4 or newer, make, OpenSSL 3, age. Recommended: 12 GiB RAM, 50 GiB disk. Outside air-gapped mode, the server needs outbound access to the vendor server over port 443.

  2. Administrator

    Verify and unpack the archive

    You get the hash value over a separate channel and compare it.

    bash
    sha256sum uaesgp-<org>-<ver>-linux-<arch>.tar.gz
    tar -xzf uaesgp-<org>-<ver>-linux-<arch>.tar.gz
    cd uaesgp-<org>-<ver>-linux-<arch>
  3. Administrator

    Run the installer

    It asks five questions: organization, internal IP, console domain, administrator email, first tenant. A tenant is a customer or division whose keys are separate. It then runs 9 stages and can be re-run. The guide says it usually takes 15-20 minutes, mostly image downloads. This is not a measured result.

    bash
    sudo ./install.sh
  4. Administrator

    Keep an offline copy of the root key

    Copy the secrets/runtime/.master/ folder to a safe offline location. This key is not included in backups. If it is lost, the data cannot be recovered, and the vendor cannot recover it either.

  5. Administrator

    Log in to the console

    Open https://<ip>:8090 in a browser and trust the certs/ca.crt certificate. Set a new password of at least 14 characters and enroll TOTP (a one-time code on your phone).

    bash: first password
    sudo cat secrets/runtime/auth/seed_password
  6. Administrator

    Create a tenant and a domain

    In the console, go to Tenants and click + Yangi tenant (new tenant): the name must match the one given to the installer. Then click + Yangi domain (new domain), for example pii.phone. A domain is a data type with its own key.

    If a domain name is mistyped in application code, a new domain with its own key may be created silently. You close this off with EG_ALLOWED_DOMAINS. The installer leaves it empty.

  7. Administrator

    Run the check

    It performs a real encryption and decryption and checks that the value is not visible in the envelope. Expected result: Tekshiruv o'tdi (Uzbek for "check passed").

    bash
    sudo make smoke DOMAIN=pii.phone
  8. Administrator

    Issue a certificate to the application

    One certificate per application. The first application can use the ready-made app identity. make recreate recreates all containers, so plan the timing.

    bash
    sudo make client-cert NAME=crm
    # .env: add crm to the EG_STORAGE_MODE_IDENTITIES list
    sudo make recreate
  9. Administrator, to developer

    Hand over the certificate and session key over a secure channel

    certs/<app>/<app>.crt, .key, ca.crt and the session key secrets/session-tokens/app-1.key, file mode 600. Also pass on the EG_JWT_ISSUER value from .env. In the examples these files sit in /etc/uaesgp/.

    Anyone holding the session key can open sessions for this tenant. Protect it like a password.

  10. Developer

    Install the SDK from the sdks/ folder

    The command for each SDK is in the installation table. For Node.js:

    bash
    cd sdks/nodejs && npm install && npm run build
    # in your application folder
    npm install /path/sdks/nodejs
  11. Developer

    Write the token provider

    The SDK does not create the session token itself. The rules and code for each language are below.

  12. Developer

    Change the column and write the first value

    Change the column type to text or jsonb. Call encrypt and store the envelope. That is your first encrypted value.

  13. Developer

    Use storage decrypt when reading from the database

    Storage decrypt opens a database value at any time and works only on port 8444, with an allowlisted certificate. Wire decrypt is for a value in transit: it decrypts once, if the envelope time is within 30 seconds. If you use wire decrypt on a database value, you get 408 TIMESTAMP_SKEW. This is a common error.

There are five integration paths, and each changes a different part of your code

No path leaves the application entirely unchanged. The table below shows what changes and what does not work.

PathWhat changes in your codeLimitationsStatus
SDK and ORM field Once: SDK, certificate, token provider. Then one line in Laravel $casts, a field type in Django, a 3-line converter and @Convert in Spring JPA. On stacks without ORM integration (Node.js, Go, .NET, Rust, plain Python or PHP), you change every read and write location that touches the field. Filtering, sorting, joins and unique indexes do not work on the column. ORM integration exists only for Eloquent, Django and JPA. A write that bypasses the ORM is not encrypted. Each operation is one call to the EG. Tested on a clean server Node.js, and Go through the CLI. Unit tested Laravel, Django, Spring, .NET: against a test server. Full table.
REST API You write every call yourself. For the EG: JWT signing, an X25519 key, a session. For EDAL: mTLS (TLS in which both sides present a certificate) and one POST. EDAL is a separate service that encrypts and decrypts one database field (Encrypted Data Access Layer), enabled with COMPOSE_PROFILES=edal. A client generated from OpenAPI does not do JWT and X25519 on its own either. Writing a script or service is still a code change. Default limit on EDAL: 200 requests per second per identity. Tested on a clean server EDAL encrypt and decrypt. EG routes through make smoke and the Node.js SDK. Not yet tested The curl sequence below in exactly this form.
PostgreSQL extension INSERT and UPDATE do not change; a trigger encrypts. Reads change: every SELECT calls uaesgp_decrypt and the role holds uaesgp_decryptor. It requires building on the server, the EDAL profile, configuration and a restart. PostgreSQL 13+ only, a C module, plpython3u, superuser. The column must be text or unbounded varchar. One HTTPS call per row in the trigger, so transactions and locks last longer. The superuser is inside the trust boundary. Unit tested 123 pgTAP tests, with a mock EDAL. Not yet tested From the archive and with a real EDAL.
JSON field-encryption proxy The caller POSTs the document to the proxy and itself sends the returned document on to the next destination. The reading side decrypts with a server SDK. One line of YAML per field. It only encrypts: it does not decrypt and does not forward anything. In field mode, JSON objects only. A path inside an array returns 422. A string field becomes an object. A renamed optional field passes through in plaintext. Tested on a clean server Field encryption. Unit tested whole_body. Not yet tested The token-refresh cron.
Whole-body encryption (sealed body) The whole JSON body of an API request or response goes into one envelope: the sender calls encryptBody or encryptJson, the receiver calls decryptBody. A body written to a database is opened with decryptStoredBody over port 8444. In the proxy it is the whole_body route. Code. All or nothing: the whole body is under one domain and one key, with no per-field access or search. The default limit is 774,144 bytes; anything larger gets 413 PAYLOAD_TOO_LARGE. The body on the wire is about 1.8 times larger. Unit tested Tests of the 12 SDKs and the proxy. Not yet tested With a live EG.

New application or one with an ORM: SDK

In Laravel, Django and Spring JPA it connects at field level. It covers both reads and writes. Code.

A language with no SDK, ETL or another database: EDAL REST

There is no extension for MySQL, Oracle, SQL Server or MongoDB. The answer for them is a script that uses this API. curl.

PostgreSQL only, with few writes: extension

The extension's own documentation recommends the SDK for high-load writers. Installation on managed PostgreSQL services has not been checked. SQL.

A legacy system sends JSON: proxy

For an integration layer where an SDK cannot be added. The call site still changes. Configuration.

Pick one write path per column. EDAL and EG envelopes are different formats: uaesgp_is_envelope recognizes only EDAL envelopes, so a column holding SDK envelopes looks like plaintext to the trigger and gets encrypted again. This conclusion is drawn from the documented structure and has not been tested.

Every integration needs one token provider, and you write it

The SDK does not create the session token. The roughly 15 lines of Ed25519 JWT signing code are yours. The methods below were checked against the SDK source. Each tab says where this code has run. Installation commands are in the SDK table.

Token rules

  • alg EdDSA, kid app-1, key /etc/uaesgp/app-1.key.
  • iss = EG_JWT_ISSUER from .env, aud = uaesgp-eg, tid = tenant, sub not empty.
  • A new jti, iat and exp every time. exp at most 15 minutes after iat. Each token is accepted once.
  • No API key: the installer leaves your own billing service off (EG_BILLING_URL=""). If you turn it on, each server SDK takes an API key parameter.

The Node.js, Go, Java and PHP signers have passed the verification function the EG uses (pkg/auth.ParseEdDSA). The Go, Java and PHP tokens have not been sent to a live EG. The Python signer has not been run. There is no signer for .NET.

Node.js

Tested on a clean server This exact flow has run with a real EG. There is no ORM integration: you change every read and write location yourself.

token.ts
import { createPrivateKey, randomUUID, sign } from 'node:crypto';
import { readFileSync } from 'node:fs';

const key = createPrivateKey(readFileSync('/etc/uaesgp/app-1.key'));
const b64 = (o: object) => Buffer.from(JSON.stringify(o)).toString('base64url');

export async function freshSessionJwt(): Promise<string> {
  const now = Math.floor(Date.now() / 1000);
  const head = b64({ alg: 'EdDSA', typ: 'JWT', kid: 'app-1' });
  const body = b64({
    iss: process.env.UAESGP_JWT_ISSUER, aud: 'uaesgp-eg', sub: 'crm',
    tid: process.env.UAESGP_TENANT, jti: randomUUID(), iat: now, exp: now + 300,
  });
  const sig = sign(null, Buffer.from(`${head}.${body}`), key).toString('base64url');
  return `${head}.${body}.${sig}`;
}
customers.ts
import { Client, Envelope } from '@uaesgp/node';
import { freshSessionJwt } from './token';

const client = new Client({
  gateway: 'https://10.0.0.5:8444',
  tenantId: 'kompaniya-a',
  jwtProvider: freshSessionJwt,
  caPath: '/etc/uaesgp/ca.crt',
  certPath: '/etc/uaesgp/app.crt',
  keyPath: '/etc/uaesgp/app.key',
});

const binding = 'customers|phone|42';
const env = await client.encrypt('+998901234567', 'pii.phone', { aadExtra: binding });
await db.query('UPDATE customers SET phone = $1 WHERE id = 42', [env.toJson()]);

const row = await db.query('SELECT phone FROM customers WHERE id = 42');
const stored = Envelope.fromJson(row.phone);
if (stored.domain !== 'pii.phone' || stored.aadExtra !== binding) throw new Error('wrong row');
const phone = (await client.decryptStored(stored)).toString('utf8');

aadExtra binds the envelope to the row. This value sits inside the envelope, and the EG does not compare it with the expected row. So the application does the check itself, and the if above is there for that. This rule also applies to Go, .NET and other calls without an ORM.

Go

Tested on a clean server The SDK has touched a real EG through uaesgp-cli, inside make smoke. This code itself has been compiled in the archive structure and has passed go vet, but has not been run on a live EG. No ORM integration.

token.go: standard library only
import (
	"context"
	"crypto/ed25519"
	"crypto/rand"
	"crypto/x509"
	"encoding/base64"
	"encoding/json"
	"encoding/pem"
	"errors"
	"os"
	"time"
)

func freshJWT(_ context.Context) (string, error) {
	raw, err := os.ReadFile("/etc/uaesgp/app-1.key")
	if err != nil {
		return "", err
	}
	block, _ := pem.Decode(raw)
	if block == nil {
		return "", errors.New("app-1.key is not PEM")
	}
	k, err := x509.ParsePKCS8PrivateKey(block.Bytes)
	if err != nil {
		return "", err
	}
	priv := k.(ed25519.PrivateKey)
	enc := func(v any) string { j, _ := json.Marshal(v); return base64.RawURLEncoding.EncodeToString(j) }
	jti := make([]byte, 16)
	if _, err := rand.Read(jti); err != nil {
		return "", err
	}
	now := time.Now().Unix()
	msg := enc(map[string]string{"alg": "EdDSA", "typ": "JWT", "kid": "app-1"}) + "." +
		enc(map[string]any{"iss": os.Getenv("UAESGP_JWT_ISSUER"), "aud": "uaesgp-eg", "sub": "crm",
			"tid": "kompaniya-a", "jti": base64.RawURLEncoding.EncodeToString(jti), "iat": now, "exp": now + 300})
	return msg + "." + base64.RawURLEncoding.EncodeToString(ed25519.Sign(priv, []byte(msg))), nil
}
customers.go
import (
	"errors"

	"github.com/uaesgp/platform/pkg/envelope"
	uaesgp "github.com/uaesgp/platform/sdks/go"
)

c, err := uaesgp.NewClient(uaesgp.Config{
	GatewayAddr: "https://10.0.0.5:8444",
	TenantID:    "kompaniya-a",
	TokenSource: freshJWT,
	CAPath:      "/etc/uaesgp/ca.crt",
	CertPath:    "/etc/uaesgp/app.crt",
	KeyPath:     "/etc/uaesgp/app.key",
})
if err != nil { return err }
defer c.Close()

binding := "customers|phone|42"
env, err := c.EncryptWithOptions(ctx, []byte("+998901234567"), "pii.phone", uaesgp.EncryptOptions{AADExtra: binding})
if err != nil { return err }
row, err := env.EncodeJSON() // write these bytes to the database

stored, err := envelope.DecodeJSON(row)
if err != nil || stored.Domain != "pii.phone" || stored.AADExtra != binding { return errors.New("wrong row") }
plain, err := c.DecryptStored(ctx, stored)

Laravel

Unit tested 58 tests passed against a test server in the lab on 9 November 2026; they have not touched a real EG. PHP 8.2 or newer is required; the signing part was checked on PHP 8.3. composer require from the archive is not yet tested. composer.json lists Laravel 10 and 11.

.env
UAESGP_GATEWAY=https://10.0.0.5:8444
UAESGP_TENANT=kompaniya-a
UAESGP_JWT_PROVIDER=App\Uaesgp\SessionTokenProvider
UAESGP_JWT_ISSUER=uaesgp-session-<customer>   # the EG_JWT_ISSUER value from .env
UAESGP_CA=/etc/uaesgp/ca.crt
UAESGP_CERT=/etc/uaesgp/app.crt
UAESGP_KEY=/etc/uaesgp/app.key
UAESGP_SESSION_CACHE_STORE=redis
app/Uaesgp/SessionTokenProvider.php
namespace App\Uaesgp;

use Uaesgp\TokenProvider;

final class SessionTokenProvider implements TokenProvider
{
    public function token(): string
    {
        $b64 = fn (string $s): string => rtrim(strtr(base64_encode($s), '+/', '-_'), '=');
        $pem  = file_get_contents('/etc/uaesgp/app-1.key');
        $der  = base64_decode(preg_replace('/-----[A-Z ]+-----|\s/', '', $pem), true);
        $pair = sodium_crypto_sign_seed_keypair(substr($der, -32)); // PKCS#8 Ed25519: the seed is the last 32 bytes
        $now  = time();
        $head = $b64(json_encode(['alg' => 'EdDSA', 'typ' => 'JWT', 'kid' => 'app-1']));
        // if you use php artisan config:cache, write config() instead of env()
        $body = $b64(json_encode([
            'iss' => env('UAESGP_JWT_ISSUER'), 'aud' => 'uaesgp-eg', 'sub' => 'crm', 'tid' => 'kompaniya-a',
            'jti' => bin2hex(random_bytes(16)), 'iat' => $now, 'exp' => $now + 300,
        ]));
        $sig = sodium_crypto_sign_detached("$head.$body", sodium_crypto_sign_secretkey($pair));
        return "$head.$body." . $b64($sig);
    }
}
app/Models/Customer.php
use Illuminate\Database\Eloquent\Model;
use Uaesgp\Laravel\Casts\Encrypted;

class Customer extends Model
{
    protected $fillable = ['name', 'phone'];
    protected $casts = ['phone' => Encrypted::class . ':pii.phone'];
}

$c = Customer::create(['name' => 'Aliyev', 'phone' => '+998901234567']); // the column holds the envelope JSON
echo $c->phone;                                                          // "+998901234567"
Without a cast, through the Facade
use Uaesgp\Laravel\Facades\Uaesgp;

$json  = Uaesgp::encryptToJson('+998901234567', 'pii.phone', 'customers.phone');
$plain = Uaesgp::decryptStored($json);
  • Only Eloquent attributes go through the cast. query()->update, insert, upsert and DB::table write plaintext, and then reading raises an error.
  • A plaintext value in the column is not returned; it raises an error. where('phone', ...) never finds anything.
  • Binding is at the jadval.ustun (table.column) level, not the row level.
  • Without UAESGP_SESSION_CACHE_STORE, every PHP-FPM request opens a new session and spends a token. Default limit: 20 sessions per second from one IP (EG_RATE_SESSION_INIT).

Django and plain Python

Unit tested 93 tests (16 of them Django) passed against a test server in the lab on 9 November 2026; they have not touched a real EG. The token function below has not been run.

core/uaesgp_tokens.py
import base64, json, os, time, uuid
from cryptography.hazmat.primitives.serialization import load_pem_private_key

_key = load_pem_private_key(open("/etc/uaesgp/app-1.key", "rb").read(), password=None)

def _b64(raw: bytes) -> str:
    return base64.urlsafe_b64encode(raw).rstrip(b"=").decode()

def issue_session_jwt() -> str:
    now = int(time.time())
    head = _b64(json.dumps({"alg": "EdDSA", "typ": "JWT", "kid": "app-1"}).encode())
    body = _b64(json.dumps({"iss": os.environ["UAESGP_JWT_ISSUER"], "aud": "uaesgp-eg", "sub": "crm",
                            "tid": "kompaniya-a", "jti": str(uuid.uuid4()), "iat": now, "exp": now + 300}).encode())
    return f"{head}.{body}.{_b64(_key.sign(f'{head}.{body}'.encode()))}"
Django: settings.py and models.py
# settings.py
UAESGP = {
    "gateway": "https://10.0.0.5:8444",
    "tenant_id": "kompaniya-a",
    "jwt_provider": "core.uaesgp_tokens.issue_session_jwt",   # dotted path or function
    "ca_path": "/etc/uaesgp/ca.crt",
    "cert_path": "/etc/uaesgp/app.crt",
    "key_path": "/etc/uaesgp/app.key",
}

# models.py
from django.db import models
from uaesgp.django import EncryptedField

class Customer(models.Model):
    name = models.CharField(max_length=200)
    phone = EncryptedField(domain="pii.phone", null=True)

# usage
c = Customer.objects.create(name="Aliyev", phone="+998901234567")   # the column holds the envelope JSON
print(Customer.objects.get(pk=c.pk).phone)                          # "+998901234567"
Plain Python
from uaesgp import Client, Config, Envelope

with Client(Config(gateway="https://10.0.0.5:8444", tenant_id="kompaniya-a",
                   jwt_provider=issue_session_jwt, ca_path="/etc/uaesgp/ca.crt",
                   cert_path="/etc/uaesgp/app.crt", key_path="/etc/uaesgp/app.key")) as client:
    stored = client.encrypt("+998901234567", "pii.phone", aad_extra="customers.phone").to_json()
    env = Envelope.from_json(stored)
    phone = client.decrypt_stored(env).decode("utf-8")
  • Customer.objects.filter(phone="...") raises FieldError; only isnull works. It does not stay silent, and the error shows at once.
  • unique=True and primary_key=True raise ValueError.
  • Decryption happens in from_db_value: each loaded row makes one EG call per encrypted field. Admin search, exports and raw SQL see the envelope.
  • Binding is at the db_table.column level, not the row level.

Java Spring

Unit tested The test suite passed against a test server in the lab on 9 November 2026; it has not touched a real EG. The signer was run separately and passed the EG verification function.

application.yml
uaesgp:
  gateway: https://10.0.0.5:8444
  tenant: kompaniya-a
  ca-path: /etc/uaesgp/ca.crt
  cert-path: /etc/uaesgp/app.crt
  key-path: /etc/uaesgp/app.key   # unencrypted PKCS#8; the installer issues it in this format
SessionJwt.java: JDK 17 only
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;
import java.time.Instant;
import java.util.Base64;
import java.util.UUID;

public class SessionJwt {
    static final Base64.Encoder B64 = Base64.getUrlEncoder().withoutPadding();
    static String b64(String s) { return B64.encodeToString(s.getBytes(StandardCharsets.UTF_8)); }

    public static String mint(String keyFile, String issuer, String tenant, String sub) throws Exception {
        String pem = Files.readString(Path.of(keyFile)).replaceAll("-----[A-Z ]+-----|\\s", "");
        PrivateKey key = KeyFactory.getInstance("Ed25519")
                .generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(pem)));
        long now = Instant.now().getEpochSecond();
        String head = b64("{\"alg\":\"EdDSA\",\"typ\":\"JWT\",\"kid\":\"app-1\"}");
        String body = b64(String.format(
                "{\"iss\":\"%s\",\"aud\":\"uaesgp-eg\",\"sub\":\"%s\",\"tid\":\"%s\",\"jti\":\"%s\",\"iat\":%d,\"exp\":%d}",
                issuer, sub, tenant, UUID.randomUUID(), now, now + 300));
        Signature s = Signature.getInstance("Ed25519");
        s.initSign(key);
        s.update((head + "." + body).getBytes(StandardCharsets.UTF_8));
        return head + "." + body + "." + B64.encodeToString(s.sign());
    }
}
Bean, JPA converter and direct call
@Configuration
class UaesgpTokens {
    @Bean
    TokenProvider uaesgpTokenProvider() {
        return () -> {
            // ISSUER: the EG_JWT_ISSUER value from .env
            try { return SessionJwt.mint("/etc/uaesgp/app-1.key", ISSUER, "kompaniya-a", "crm"); }
            catch (Exception e) { throw new IllegalStateException(e); }
        };
    }
}

// JPA: one small class per column
@Converter
public class CustomerPhoneEncrypted extends EncryptedConverter {
    public CustomerPhoneEncrypted() { super("pii.phone", "customer|phone"); }
}

@Entity
public class Customer {
    @Id Long id;
    @Convert(converter = CustomerPhoneEncrypted.class)
    private String phone;
}

// Or directly, with the row binding a converter cannot do
String stored = client.encryptToJson("+998901234567", "pii.phone", "customers|phone|42");
String phone  = client.decryptStoredToString(Envelope.fromJson(stored), "pii.phone", "customers|phone|42");
  • JPA binding is at column level: an envelope still decrypts if copied to another row of the same column.
  • Each read and write is one EG request. JPQL filters and bulk JPQL updates do not work on the column.
  • uaesgp.jpa.allow-legacy-plaintext: true exists for the migration period. While it is on, anyone who can write to the column can insert plaintext of their choosing.

.NET

Unit tested 43 tests passed against a test server in the lab on 9 November 2026; they have not touched a real EG.

Not yet available A ready-made token signer. The standard library has no Ed25519. Uaesgp.Sdk depends on BouncyCastle.Cryptography 2.4.0, and you write the signer with it according to the rules above. We have not written and tested one, so we show no code here.

Customers.cs
using Uaesgp.Sdk;

await using var client = new UaesgpClient(new UaesgpOptions
{
    Gateway       = "https://10.0.0.5:8444",
    TenantId      = "kompaniya-a",
    TokenProvider = ct => tokens.FreshSessionJwtAsync(ct), // your signer, Func<CancellationToken, ValueTask<string>>
    CaPath        = "/etc/uaesgp/ca.crt",
    CertPath      = "/etc/uaesgp/app.crt",
    KeyPath       = "/etc/uaesgp/app.key",
});

const string binding = "customers|phone|42";
string stored = await client.EncryptToJsonAsync("+998901234567", "pii.phone", binding);
string phone  = await client.DecryptStoredToStringAsync(Envelope.FromJson(stored), "pii.phone", binding);
ASP.NET Core DI: reads the Uaesgp section
builder.Services.AddSingleton<IUaesgpTokenProvider, MyProvider>();
builder.Services.AddUaesgp(builder.Configuration);

Not yet available An EF Core converter. The SDK README has only an example you write yourself, which is blocking and at column level.

With REST you do the SDK's work yourself: token, X25519 key and session

For languages without an SDK and for scripts. The specification is in the archive: api/openapi/eg.yaml (OpenAPI 3.1) and docs/07-api.md. A generated client does not sign JWTs or create X25519 keys on its own either.

Port 8444: server applications

mTLS, TLS 1.3, certificate mandatory. The identity comes from the certificate. Storage decrypt and key release exist only here.

Port 8443: browsers and mobile

TLS 1.2+, no client certificate. Wire decrypt only: the envelope time must be within 30 seconds, and only once. A second attempt gets 409 REPLAY_DETECTED, a stale one 408 TIMESTAMP_SKEW.

Routes: POST /v1/session/init, POST /v1/session/close, POST /v1/encrypt, POST /v1/decrypt, GET /v1/pubkey, and on the internal port POST /v1/keys/release. The Authorization header is not used: the session ID is sent in X-Session-ID.

Not yet tested This sequence has not been run on a live stack in exactly this form. Every path, header and field was compared with the handler code. make smoke and the Node.js SDK have passed through these same routes on a clean server.

EG: from the archive folder, as a user who can read the key files
# 1. one-time token, with the tool in bin/
JWT=$(sudo bin/uaesgp-cli token --key-file secrets/session-tokens/app-1.key --kid app-1 \
  --issuer "$(sudo sed -n 's/^EG_JWT_ISSUER=//p' .env)" --tenant kompaniya-a --sub curl-test)

# 2. a new X25519 public key; the SDK does this itself
openssl genpkey -algorithm X25519 -out x.pem
PUB=$(openssl pkey -in x.pem -pubout -outform DER | tail -c 32 | base64)

# 3. open a session over mTLS
M="--cacert certs/app/ca.crt --cert certs/app/app.crt --key certs/app/app.key"
SID=$(curl -sS $M https://10.0.0.5:8444/v1/session/init -H 'Content-Type: application/json' \
  -d "{\"jwt\":\"$JWT\",\"client_pub\":\"$PUB\",\"tenant_id\":\"kompaniya-a\"}" | jq -r .session_id)

# 4. encrypt; plaintext is the standard base64 form of +998901234567
curl -sS $M https://10.0.0.5:8444/v1/encrypt -H 'Content-Type: application/json' -H "X-Session-ID: $SID" \
  -d '{"domain":"pii.phone","plaintext":"Kzk5ODkwMTIzNDU2Nw==","aad_extra":"customers|phone|42"}' > envelope.json

# 5. decrypt the stored value; 8444 only, and the identity must be on the allowlist
curl -sS $M https://10.0.0.5:8444/v1/decrypt -H 'Content-Type: application/json' \
  -H "X-Session-ID: $SID" -H 'X-Decrypt-Mode: storage' --data-binary @envelope.json
# response: {"plaintext":"Kzk5ODkwMTIzNDU2Nw=="}
Sample envelope, 13-byte input
{"v":"1","alg":"AES-256-GCM","tenant_id":"kompaniya-a","session_id":"9a1f0c2e7d3b4a5f8e6d7c1b2a3f4e5d","domain":"pii.phone","key_id":"6f1d2c3b-0a9e-4f8d-8c7b-6a5f4e3d2c1b","key_version":3,"nonce":"1852615ed216ed44616988c28396e100457c738f7ffb3e23cec8e976c9ac8486","timestamp":1793978199406,"iv":"9a46a9870d9af566ab467362","ciphertext":"DWyNuItRKjVdAmsQIg==","auth_tag":"vwUEkg5r8BKkcRDn7v9stQ==","mac":"g1CIB9V6VPK5XyDrT9H0L3JW1Rs4SwhY5bOA/hJyGok=","signature":"DeszoSKVIXK8aNfDQAAPvGtQ2Lq6GMRy8InLiA7amMgdvkXrrtCJ7vFT2+f7SHSrENXogRyzci6J/U2EKBsQCQ==","kid":"6e31eef995832e35","aad":"kompaniya-a|pii.phone|6f1d2c3b-0a9e-4f8d-8c7b-6a5f4e3d2c1b|1793978199406|customers|phone|42","aad_extra":"customers|phone|42"}

Tenant, domain, key ID, time and aad_extra sit in the clear in the envelope. Do not put a secret value in aad_extra.

EDAL REST: for other databases and ETL

Tested on a clean server Encrypt and decrypt. mTLS only, and the tenant is determined from the certificate. plaintext here is a plain UTF-8 string, not base64. Domains are lowercase only.

bash
M="--cacert ca.crt --cert pg-crmdb.crt --key pg-crmdb.key -H Content-Type:application/json"
curl -sS $M -d '{"domain":"pii","field":"customers.phone","plaintext":"+998901234567","row_context":"42"}' \
  https://10.0.0.5:11443/v1/encrypt > envelope.json
curl -sS $M -d "{\"domain\":\"pii\",\"field\":\"customers.phone\",\"row_context\":\"42\",\"envelope\":$(cat envelope.json)}" \
  https://10.0.0.5:11443/v1/decrypt

uaesgp-cli is also in the archive's bin/ folder, but it works on one value at a time and is not a bulk tool.

The extension encrypts writes with no changes, but read queries change

A trigger encrypts on INSERT and UPDATE. The application sees the envelope JSON until it calls uaesgp_decrypt.

Unit tested 123 pgTAP tests pass, with a mock EDAL. Not yet tested Installing from the archive and working with a real EDAL.
.env, then sudo make recreate
COMPOSE_PROFILES=edal
EDAL_BIND_IP=10.0.0.5
EDAL_CLIENT_TENANTS=pg-crmdb=kompaniya-a
EDAL_CLIENT_DOMAINS=pg-crmdb=pii
EDAL_SEARCH_IDENTITIES=pg-crmdb        # only if a search token is needed
Building on the database server
# C compiler, postgresql-server-dev-<major>, plpython3u,
# PostgreSQL 13+, Python 3.7+, OpenSSL 1.1.1+, superuser required
cd integrations/postgres
make with_llvm=no && sudo make with_llvm=no install
postgresql.conf, then restart
shared_preload_libraries = 'uaesgp'
uaesgp.edal_url  = 'https://10.0.0.5:11443'
uaesgp.ca_file   = '/etc/uaesgp/certs/ca.crt'
uaesgp.cert_file = '/etc/uaesgp/certs/pg-crmdb.crt'
uaesgp.key_file  = '/etc/uaesgp/certs/pg-crmdb.key'
SQL
CREATE EXTENSION uaesgp CASCADE;
SELECT uaesgp.uaesgp_health();  -- true

-- from here on, records are encrypted automatically
CREATE TRIGGER customers_phone_enc
    BEFORE INSERT OR UPDATE OF phone, id ON customers
    FOR EACH ROW EXECUTE FUNCTION
    uaesgp.uaesgp_encrypt_trigger('phone', 'pii', 'customers.phone', 'id');
GRANT uaesgp_encryptor TO app_writer;

-- the read query changes
GRANT uaesgp_decryptor TO risk_analyst;
SELECT uaesgp.uaesgp_decrypt(phone, 'pii', 'customers.phone', id::text) FROM customers WHERE id = 42;

-- existing plaintext values, outside a transaction block
CALL uaesgp.uaesgp_backfill('public.customers', 'phone', 'pii', 'customers.phone');

-- prove no plaintext values remain; the result must be 0
SELECT count(*) FROM customers WHERE phone IS NOT NULL AND NOT uaesgp.uaesgp_is_envelope(phone);

-- forbid plaintext values at database level
ALTER TABLE customers ADD CONSTRAINT customers_phone_encrypted
    CHECK (phone IS NULL OR uaesgp.uaesgp_is_envelope(phone)) NOT VALID;
ALTER TABLE customers VALIDATE CONSTRAINT customers_phone_encrypted;

-- exact-match search, through a separate token column
ALTER TABLE customers ADD COLUMN email_token text;
SELECT id FROM customers
WHERE email_token = uaesgp.uaesgp_search_token('Alice@Example.com', 'pii', 'customers.email');
  • Views work too, but the view role also gets uaesgp_decryptor and can use it to decrypt any envelope directly.
  • The column must be text or unbounded varchar, otherwise 42804. The plaintext value limit is 512 KiB.
  • Search is exact-match only, and the query changes. A token on values such as a phone number or JShShIR (the personal ID number) allows dictionary guessing, so guard this right as you would decrypt.
  • The superuser and the postgres OS user are inside the trust boundary: they can read the client key. An SQL injection running with the uaesgp_decryptor role returns plaintext values.

The proxy encrypts the document and returns it to you; it sends nothing anywhere itself

A separate service for legacy systems. You POST one JSON object, and the listed fields come back replaced by envelopes. A body sent to a path on the whole_body list is sealed whole in one envelope.

Tested on a clean server Field encryption, from the bundle. Unit tested whole_body. Not yet tested The cron that renews the token.
config/proxy.yaml
tenant_id: "kompaniya-a"
listen: "0.0.0.0:8443"
gateway:
  url: "https://eg:8444"
  ca: "/etc/uaesgp/certs/ca.crt"
  cert: "/etc/uaesgp/certs/proxy.crt"
  key: "/etc/uaesgp/certs/proxy.key"
  jwt_file: "/run/secrets/proxy_eg_jwt"
  api_key_file: "/run/secrets/proxy_eg_api_key"
domains:
  - name: pii
    fields:
      - path: "customer.ssn"
        required: true
      - "customer.email"
  - name: financial
    fields:
      - "transaction.amount"
      - "account.number"
whole_body:                     # optional: the whole body of this path
  - path: "/v1/statements"
    domain: pii
Calling it, default host port 8445
curl -sS --cacert certs/crm/ca.crt \
  --cert certs/crm/crm.crt \
  --key certs/crm/crm.key \
  -H 'Content-Type: application/json' \
  -d '{"customer":{"name":"Ali","ssn":"123-45-6789"}}' \
  https://10.0.0.5:8445/
# response:
# {"customer":{"name":"Ali","ssn":{"__uaesgp_env__":"eyJ2IjoiMSIsImFsZyI6..."}}}

.env: add proxy to COMPOSE_PROFILES, PROXY_BIND_IP=10.0.0.5, PROXY_CLIENT_IDENTITIES=crm. A cron job must rewrite the secrets/runtime/proxy/eg_jwt file every 5 minutes with uaesgp-cli token. If it is not renewed, the next session does not open.

  • It only encrypts. It does not decrypt responses. The reader takes __uaesgp_env__ out of base64 with a server SDK and does a storage decrypt. The SDK has no helper for the field wrapper, but has one for the whole body (decryptBody, decryptStoredBody).
  • It forwards nothing. The caller itself sends the result to the next destination. The legacy system's code or integration layer changes.
  • In field mode, JSON objects only. No XML, forms, SQL or binary. A path inside an array returns 422 UNSUPPORTED_SHAPE. The body limit is 4 MiB by default, 16 MiB at most.
  • The document shape changes. A string field becomes an object, which breaks a receiver expecting a string.
  • A renamed optional field passes through in plaintext. Only the uaesgp_proxy_fields_absent_total metric shows this. Put required: true on a field that must not leak.
  • No row binding. In field mode aad_extra is not used, and the envelope is not bound to a row or column. In whole_body mode aad_extra is the request path itself: it does not bind the response to an object.
  • Whole-body mode. A body sent to an exact path in whole_body: [{path, domain}], any JSON value, goes into one envelope. The receiver opens it with the SDK's decryptBody helper. Not yet tested on a live EG.

There are 12 SDKs, and only two have touched a real EG

All are source code in the archive's sdks/ folder, version 2.0.0, in 10 languages. Server SDKs decrypt stored data. Browser and mobile SDKs only encrypt and do wire decrypt. A test server is a test program that responds like the EG.

SDK and folderStatusWhat it hasTests
Node.js nodejsTested on a clean serverServer. Storage decrypt, key release. No ORM integration.Encrypt and storage decrypt with a real EG. 33/33 tests passed in the final integration.
Go goTested on a clean serverServer. Storage decrypt, key release. The proxy and CLI are written with this SDK. No ORM integration.On a real EG through the CLI, inside make smoke. 48 tests passed.
Rust rustUnit testedServer, Tokio. Storage decrypt, key release.29 unit, 20 integration and 6 doc tests passed with a test server, also in the lab on 9 November 2026. Has not touched a real EG.
Flutter flutterUnit testedMobile, 8443 only. Encrypt and wire decrypt. No Web.30 tests passed, with a test server. Has not touched a real EG.
Python pythonUnit testedServer, sync and async. Django EncryptedField, encrypt_plaintext_rows.93 tests passed against a test server in the lab on 9 November 2026. Has not touched a real EG.
PHP, Laravel php-laravelUnit testedServer. Eloquent cast, Facade, CacheSessionStore.58 tests passed against a test server in the lab on 9 November 2026. Has not touched a real EG.
Java, Spring java-springUnit testedServer. Spring Boot autoconfiguration, JPA EncryptedConverter, PKCS#12.The test suite passed against a test server in the lab on 9 November 2026. Has not touched a real EG.
.NET dotnetUnit testedServer, async. AddUaesgp DI, Windows certificate store. No EF Core converter.43 tests passed against a test server in the lab on 9 November 2026. Has not touched a real EG.
TypeScript, browser typescript-browserNot yet tested8443 only. Two operations: encrypt and wire decrypt.10 tests passed in the lab on 9 November 2026. Not run in a browser app or against a real EG.
React Native react-nativeNot yet tested8443 only. iOS and Android native modules for CA pinning.13 tests passed in the lab on 9 November 2026. No tests for the native code. Not run in an app or against a real EG.
Android, Kotlin android-kotlinNot yet tested8443 only. Encrypt and wire decrypt.16 tests written. Not run.
iOS, Swift ios-swiftNot yet tested8443 only. Encrypt and wire decrypt. No external dependencies.32 tests written, but they could not be run. Builds from the repo, does not build from the archive.

A CI configuration exists but has not yet run on a GitLab runner. The full status is on the Security page.

Installing from the archive

Each command points at a local folder. A browser or mobile SDK gets the session token from your server and connects only to 8443.

SDK, requirementInstallationHas this command been tested
Node.js 22+cd sdks/nodejs && npm install && npm run build, in the application npm install /path/sdks/nodejsTested on a clean server
Go 1.26+In go.mod, require github.com/uaesgp/platform v0.0.0 and replace github.com/uaesgp/platform => /path/sdks/go/module, then go mod tidyRun in the archive structure; tidy and build pass
Rust 1.75+uaesgp = { path = "/path/sdks/rust" }Builds in the archive structure
Flutter 3.13+, Dart 3.1+uaesgp: { path: /path/sdks/flutter } in pubspec.yamlpub get and flutter analyze lib are clean in the archive structure
Python 3.9+pip install /path/sdks/python or pip install "/path/sdks/python[django]"Not yet tested
PHP 8.2+, ext-curl ext-json ext-openssl ext-sodiumA path repository in composer.json: "repositories": [{ "type": "path", "url": "/path/sdks/php-laravel" }], then composer require "uaesgp/sdk:@dev"Not yet tested
Java 17+, Spring Boot 3cd sdks/java-spring && mvn install, then the uz.uaesgp:sdk:2.0.0 dependency. It lands only in the local ~/.m2; CI needs an internal repositoryNot yet tested
.NET 8cd sdks/dotnet && dotnet pack -c Release Uaesgp.Sdk, then dotnet add /path/App.csproj package Uaesgp.Sdk --version 2.0.0 --source "$PWD/Uaesgp.Sdk/bin/Release"Not yet tested
TypeScript, browsercd sdks/typescript-browser && npm install && npm run build, then npm install /path/sdks/typescript-browser. There is no prebuilt dist/Not yet tested
React Native 0.74+npm install /path/sdks/react-native, then cd ios && pod installNot yet tested
Android, minSdk 24cd sdks/android-kotlin && ./gradlew publishToMavenLocal, then mavenLocal() and implementation("uz.uaesgp:sdk-android:2.0.0")Not yet tested
iOS 15+, macOS 12+, tvOS 15+, Swift 6.package(path: "/path/sdks/ios-swift"). The test folder has been removed from the archive, but Package.swift still declares it. It builds if you remove the test targetNot yet available Does not build from the archive

No SDKs in public registries

The SDK README files contain public registry commands. Do not use them. Our packages are in no registry, and a package under these names may belong to someone else. In Go, do not remove the replace line.

Dependencies need a registry or an internal mirror

The archive has no prebuilt SDK artifacts or third-party packages. Every SDK except Swift goes to a registry or internal mirror during installation. An air-gapped network needs an internal mirror. npm install /path links to a folder, so run npm pack first in a Docker build.

Integration for other ORMs

Not yet available

SQLAlchemy, Prisma, TypeORM, Sequelize, GORM, Diesel, EF Core. Here you write the calls yourself.

Search token in the SDK, and a ready-made sample project

Not yet available

Equality search exists only in EDAL and the PostgreSQL extension. The archive has no runnable sample project. Documentation exists: docs/07-api.md, docs/08-sdk.md.

A ready-made migration tool exists on only two stacks; on the rest you write the script yourself

Plaintext values already in the database do not get encrypted on their own. Migration (backfill, encrypting existing rows) takes operations, time and clean-up of old copies.

  • Plaintext
  • Encrypted: envelope or key
  • Something you do
  1. Count first

    Every column of every row is at least one operation. 2 million rows and 3 columns are at least 6 million: agree the monthly limit with the vendor first.

  2. The column and your queries

    The column becomes TEXT or JSONB. Search, sorting, joins and unique indexes on it stop working.

    Equality search token Unit tested

  3. Migrating in batches

    The tool reads rows in small batches, encrypts them and writes them back. Start with a small batch and time it.

    PostgreSQL uaesgp_backfill: tested with a mock EDAL Unit testedPostgreSQL uaesgp_backfill: from the bundle, with a real EDAL Not yet testedDjango encrypt_plaintext_rows: test written, not run Not yet testedLaravel: the chunkById script from the README Not yet testedA ready-made tool for Spring and other stacks, MySQL, Oracle, SQL Server, MongoDB Not yet available

  4. Prove it is done

    The count of plaintext rows must be 0. In PostgreSQL a CHECK constraint then blocks plaintext writes. Decrypt random rows and compare.

  5. Plaintext copies remain

    Even after encryption, plaintext stays in old row versions, the WAL, backups, dumps, replicas, freed disk blocks and logs.

  6. Clean up one by one

    You remove the plaintext copies one by one. This cannot be undone: check first that the envelopes decrypt.

    Rollback: an offline export or decrypt tool Not yet available

There is no rollback tool: you write the decryption script yourself, and it uses operations too. In Laravel and Django, unmigrated rows cannot be read until the migration ends. Full list: what has been tested and what has not.
TargetToolStatusNote
PostgreSQLCALL uaesgp.uaesgp_backfill(tbl, col, domain, field, batch_size => 500, row_bound => true, max_rounds => 5)Unit testedNot yet testedTested with a mock EDAL. Not tested from the archive or with a real EDAL. Requires a single-column primary key, runs outside a transaction and can be re-run.
Djangoencrypt_plaintext_rows(Customer, "phone", batch_size=500)Not yet testedTest written but not run. It works once the field is an EncryptedField, and can be re-run.
LaravelA roughly 25-line chunkById script from the README. There is no Artisan commandNot yet testedsave() is not enough: an unchanged attribute is not written.
Spring JPAThe loop is yours. For reads there is allow-legacy-plaintext: trueNot yet availableNo ready-made tool, only a transition mode.
Node.js, Go, .NET, Rust, plain PHP or PythonA one-off script: reads, encrypts, rewritesNot yet availableYou write the script yourself.
MySQL, Oracle, SQL Server, MongoDBA script that uses the EDAL APINot yet availableThere is neither an extension nor a tool for these databases.
RollbackYou write the decrypt loop yourself. The CLI decrypts one envelope through the EGNot yet availableThere is no offline export or rollback tool.

Operations

Each row and column is at least one operation. 1 million rows and 2 columns is at least 2 million operations: far more than the monthly limit of 10,000 on the free Trial plan, and 40% of the 5 million monthly limit on Start. Include migration when you size the license.

Time

The default EDAL limit is 200 calls per second. One million rows take about 1.4 hours. This is calculated from the configured limit, not measured. The trigger and backfill make one HTTPS call per row.

Schema

The column type and length change. You rewrite queries with filters, sorting and unique indexes in advance. After that, reports on this column see the envelope.

Mandatory work around a backfill

From the extension's documentation. The principle applies to any database.

  1. Rewrite the table: VACUUM FULL or pg_repack. VACUUM FULL takes an exclusive lock.
  2. Destroy pre-backfill WAL archives, base backups and dumps according to your retention policy. Until then, plaintext values remain in them.
  3. Rebuild physical and logical replicas.
  4. Keep the disk encrypted: freed blocks are not wiped.
  5. Prove completion with a uaesgp_is_envelope count of 0, then add the CHECK constraint.

A trap during the transition

The Laravel cast and Django field raise an error on a plaintext value. Between deploying the cast and finishing the backfill, reading unmodified rows does not work. A read mode exists only in JPA (allow-legacy-plaintext) and PostgreSQL (uaesgp.allow_plaintext = on). While it is on, anyone who can write to the column can insert plaintext of their choosing.

Rotation does not re-encrypt existing data

A new record lands on the new key version, and an old envelope decrypts with the old version. There is no tool for bulk re-encryption of envelopes. If needed, this is the application's job.

These limitations affect your architecture before you write any code

The diagram continues to the right: scroll sideways →

Phone number, plaintext: 13 bytes EG envelope, measured: 699 bytes EDAL envelope, measured on a clean server: about 280 bytes Proxy output, calculated from 699 bytes: about 954 bytes
A 13-byte value becomes 699 bytes, and a 56-byte value 755 bytes. The solid bars are measurements (the EG envelope with envelope.Seal); the proxy bar is a calculation. CHAR(13) and VARCHAR(20) cannot hold the envelope.

Filtering, sorting and unique indexes do not work on an encrypted column

The ciphertext is different every time. Equality, range, LIKE, ORDER BY, JOIN, GROUP BY and unique constraints do not work. The SDK path has no search token: you need your own keyed hash column or a separate EDAL call. An EDAL token shows which values are equal.

Reads count too

Each encrypt and decrypt through EG or EDAL is one operation. In Django, a 50-row list with 3 encrypted columns: 150 EG calls and 150 operations. Calculate monthly volume by adding writes and reads. Plans.

Each operation is one network call

The only measurement is from the lab: about 4,000 operations per second with the EG on 2 CPUs. Measure under your own load. If the EG is down, protected fields cannot be read. A single-server installation has no high availability.

If the application is compromised, protection ends there

An SQL injection that copies a table gets only the envelope. An SQL injection that forces the application to decrypt and return gets the plaintext value. A compromised application server can decrypt its own tenant's data while compromised. Each decrypt is logged in the audit trail, but not stopped.

Key operations are irreversible or do not touch existing data

Key revocation is practically irreversible: old envelopes return KEY_REVOKED. Rotation does not re-encrypt existing data. The default root key is software-based; the HSM path exists in the code but is not yet tested.

Everything outside the database is your job

No plaintext values should end up in logs, analytics, BI, caches or search systems. UAESGP does not protect them. Adding a new application requires sudo make recreate, which recreates all containers on the one server.

An external penetration test has not yet been carried out, and certification and O'z DSt algorithms are not yet available. The full list is on the Security page.

If the usage lease runs out or the monthly limit is reached, decrypt stops too

The usage lease is a vendor-signed permission with a limited term. Your application should plan for this state in advance.

Without a lease

EG and EDAL neither encrypt nor decrypt, and the KMS does not release keys. The default term is 72 hours.

If the vendor server is down

The deployment works until the current lease term or the current operations block ends, whichever comes first. A block is 5% of the monthly limit. If there is no verified check-in for more than 7 days, all services stop together with the console. This has not been tested yet.

If the monthly limit is reached

Both encrypt and decrypt stop with 402 (LICENSE_QUOTA_EXHAUSTED), until the next period or a larger license.

Air-gapped site

An airgapped license and an offline-signed lease.json file, usually monthly. The vendor does not see the counter and cannot revoke. When the file's term or operation count runs out, operations stop. This is available on the Enterprise plan. The offline bundle of third-party images (INFRA=1) is not yet tested.

Handle 402 separately in your code. Decide in advance how the application works without the protected field.

The vendor server receives the license ID, instance ID, service name, version, operation count, binary hash, source IP and User-Agent. Neither data nor keys go there. In air-gapped mode nothing goes there.

Tested on a clean server Bypass was attempted with .env edits, a vendor block and the monthly limit, and the system refused.

A whole JSON body can be sent in one envelope; this path is not yet tested on a live EG

The whole body of an API request or response goes into one envelope without being split into fields. The sender does one encryption and the receiver one decryption: each is 1 operation whatever the body size. On the wire the body is replaced by {"__uaesgp_env__":"…","__uaesgp_type__":"json"}.

Unit tested The tests of the 12 SDKs and the proxy pass against a test server. Not yet tested With a live EG, in an iOS and tvOS build, on React Native Hermes.
Node.js: sealing and opening a whole response
// sender: the whole response in one envelope, bound to the request address
const route = 'GET /v1/accounts/42';
const sealed = await client.encryptJson(account, 'pii.account', {
  aadExtra: route,
});
res.type('application/json').send(sealed);

// receiver: opens the envelope within 30 seconds, and only once
const data = await client.decryptJson(await reply.text(), {
  expectedDomain: 'pii.account',
  expectedAadExtra: route,
});
  • An envelope in transit opens once. decryptBody opens it within 30 seconds and only once. Open a body written to a database or queue with decryptStoredBody: it needs port 8444 and a certificate on the EG_STORAGE_MODE_IDENTITIES list.
  • Bind it to the address. Put the request address and the object in aadExtra, and check them on the receiver with expectedAadExtra and expectedDomain. Otherwise another response from the same domain would open too.
  • Only a session of this tenant opens the envelope. If another organization has to open it, see the partner section.
  • All or nothing. The whole body is under one domain and one key. You cannot grant per-field access or search. For individual database columns, use field encryption.
  • Size. The default limit is 774,144 bytes; anything larger gets 413 PAYLOAD_TOO_LARGE. Up to about 12 MiB with EG_MAX_BODY_BYTES. The body on the wire is about 1.8 times the original.
  • Other languages. All 12 SDKs have the helpers; their names are in section 10 of docs/08-sdk.md. In the proxy it is the whole_body route: JSON proxy.

A partner can decrypt the envelope on its side, but this path is not yet fully tested

The partner gets the envelope from your API and decrypts it with the data key in its own process. The ciphertext does not come back to you, and the plaintext value appears at the partner.

  • Plaintext
  • Encrypted: envelope or key
  • Metadata anyone can see
  • Something you do
  • Refused
  1. What does not work

    Each installation creates its root key on its own server. Neither the partner's EG nor the vendor can open your envelope.

    The three paths when the partner also runs UAESGP Not yet tested

  2. Path 1: through your EG

    The partner sends the envelope to your EG and gets the plaintext back over TLS. The operation and the log entry are yours.

    Sealing a whole body in one envelope (12 SDKs, proxy whole_body) Unit testedSDKs: browser TypeScript, React Native, Android, iOS Not yet tested

  3. Path 2: releasing the key

    Your EG wraps the domain key for the partner, who decrypts on its own side. Your log records only the key release.

    Partner key release Unit testedThe full flow of key release to a partner Not yet testedReleasing a key to oneself as a partner: rejected Tested on a clean server

  4. Path 3: with the partner's EG

    You encrypt the response with the partner's EG, and the partner decrypts it whenever it needs. The operations and the log are the partner's.

    The three paths when the partner also runs UAESGP Not yet tested

  5. Revoking access

    You revoke access in stages. Revoking the domain key is the strongest step and cannot be undone.

    Revoked client certificate: may be accepted for up to 30 seconds, then rejected Tested on a clean serverKey revocation and its propagation to gateways Unit tested

QuestionPath 1: through your EGPath 2: releasing the keyPath 3: the partner's EG
Who opens the envelopeYour EG, which returns the plaintext over TLSThe partner application, on its own serverThe partner's EG
Who sees plaintext outside your sidePartner applicationPartner applicationThe partner's EG and application
When it can be openedWithin 30 seconds, once. A stored body through 8444 at any timeWithin about one day in the worst caseAt any time
Which portThe partner to your port 8443The partner to your port 8444You to the partner's port 8443
What the license needsNo extra rightkey-release rightOne free tenant slot at the partner
Whose operations are usedYours: encryption and each decryptionYours: encryption and each key releaseThe partner's
Is decryption in your audit logYesNo, only the key releaseNo, it goes to the partner's log
All three paths exist in the code, but none has been tested end to end on a live EG. Check with the partner in a test environment first. Full list: what has been tested and what has not.
Unit tested With a mock EG and a sample program in development mode. Not yet tested The full flow. On a clean server, only the "release a key to oneself" attack has been tested, and it was refused.

Flow

  1. The partner gets the envelope from your API. UAESGP does not carry it.
  2. It gets a one-time JWT from you, with sub set to the partner and dom to ["partner.acme"].
  3. It opens a session on port 8444 of the EG with its own certificate.
  4. It requests the data key wrapped to a new X25519 key of its own process.
  5. It verifies the EG signature and decrypts the envelope on its side.
Your side
# in the console, a domain for this partner only: partner.acme
sudo make client-cert NAME=partner-acme
# .env: EG_RELEASE_IDENTITIES=partner-acme=kompaniya-a
sudo make recreate
# to the partner: certs/partner-acme/* and
# secrets/runtime/public/eg_signing.pub.pem
Partner side: no platform, server SDK only
c, err := uaesgp.NewClient(uaesgp.Config{
	GatewayAddr:  "https://10.0.0.5:8444",
	TenantID:     "kompaniya-a",
	TokenSource:  tokenFromYourAPI,
	CAPath:       "/etc/uaesgp/ca.crt",
	CertPath:     "/etc/uaesgp/partner-acme.crt",
	KeyPath:      "/etc/uaesgp/partner-acme.key",
	LocalDecrypt: true,
	EGVerifyKeys: []ed25519.PublicKey{egKey}, // from eg_signing.pub.pem
})
plain, err := c.Decrypt(ctx, env)
In other server SDKs
// Node.js
client.createReleaseClient({ egVerifyKeys: [pinnedEgKey] }).openEnvelopeStr(json)
# Python
client.release_client(eg_verify_keys={kid: key}).open_envelope_str(json)
// PHP
$client->releaseClient([...])->openEnvelope($json)
// Java
ReleaseClient.builder()...egVerifyKey(key).build().openEnvelopeUtf8(json)
// .NET
new ReleaseClient(new ReleaseConfig { EgVerifyKeys = ... })
// Rust
ReleaseClient::new

Conditions you should know in advance

  • The key decrypts the whole domain. Encryption is with the domain key, not a per-record key. That is why a separate domain for the partner is mandatory.
  • Revocation does not reach the local cache. The partner can use the key until the cache term ends. The term is an SDK setting, and its limit varies by language; see section 9 of docs/08-sdk.md.
  • A released key is outside metering. What the partner decrypts locally with the key is not logged or counted by the EG. The key release calls themselves are counted and logged in the audit trail.
  • The license must include key-release. Otherwise 403 LICENSE_FEATURE_REQUIRED. This is agreed separately in the contract.
  • Local decryption does not check time or nonce. Replay protection is the application's job.
  • EG_RELEASE_PARTNER_KEYS does not work with the SDK. Each ReleaseClient creates a new key, and the response is 403 PARTNER_KEY_NOT_ALLOWED.
  • Do not turn off signature verification. Python, PHP, Java and .NET have a flag that turns it off. The flag must stay off.
  • Network and limits. The partner must be able to reach your port 8444. Default limit: 5 key requests per second per partner (EG_RATE_RELEASE). The browser and mobile SDKs do not have this capability.

Ways to revoke: remove it from EG_RELEASE_IDENTITIES and run sudo make recreate, or sudo bash platform/scripts/gen-certs.sh revoke partner-acme, or Revoke the domain key in the console.

If a partner calls your API: apigw

Tested on a clean server Tested forwarding to the proxy: a signed request 200, a replay with the same nonce 409 REPLAY_DETECTED, a request signed with a foreign key 401 AUTH_FAILED. Not yet tested Forwarding to your own API.

apigw checks the Ed25519 signature, the time and the one-time nonce of every request, then passes the request to your API. The partner creates its key pair on its own side and gives you only the public key. To enable it, add apigw to COMPOSE_PROFILES, then set APIGW_UPSTREAM_URL, APIGW_AUDIENCE and APIGW_BIND_IP.

If the partner also runs UAESGP

The partner's own platform cannot open your envelope: each installation creates its root key on its own server. The partner opens the envelope by one of three paths.

Not yet tested All three paths are in the code but have not been tested between two separate installations. Check them in a test environment first.

1. Opening through your EG2. Giving the key to the partner3. Encrypting with the partner's EG
Who opens the envelopeYour EG, which returns the plaintext to the partner over TLSThe partner's application, on its own serverThe partner's EG
Which port is usedThe partner connects to your port 8443 (8444 for decryptStoredBody)The partner connects to your port 8444You connect to the partner's port 8443
LicenseNo extra right neededThe key-release rightOne free tenant slot in the partner's license
Whose operations are usedYours: encryption and each opening, 1 operation eachYours: encryption and each key release, 1 operation eachThe partner's
Written to your audit logYesNo, only the key releaseNo, it goes to the partner's log

Integration time has not been measured, and speed only in the lab: measure both on your own stack

The pilot is free for one month, with 10,000 operations a month, in a test environment. Tell us which SDK your stack needs, and we will state its status plainly.

If no mail app opens, write to this address: ogabekkadirov.dev@gmail.com

A platform that encrypts sensitive data in database columns, in API requests and responses, on its way out of apps and to partners. Keys are kept apart from the data, and everything runs on your own servers.

Product

Trust

© 2026 UAESGP MCHJ, TIN 123456789, Tashkent Shahar, Yunusobod tumani, 100011, O'zbekiston. This page loads no third-party scripts, fonts or cookies. Your theme choice stays in your browser only.