Try the Encryption Plugin for Firebird v2027R1

Download the package with a trial license and encrypt a test database. All functions work. Use the ready example, or do the eight steps on your own Firebird.

  • Firebird 5.0 · 4.0 · 3.0 (from 3.0.3)
  • Windows and Linux · x64 servers · 32- and 64-bit clients
  • Trial license in each archive
  • 8 steps from the archive to an encrypted backup
  • 10 minutes for the ready example

Start

Choose your way

All three ways use the same plugin and give the same result: an encrypted database and a server that keeps no key.

10 minutes · Windows

Run the ready example

The scripts install a separate test server on its own port. They do not change your Firebird. You get an encrypted database and an application that opens it.

The commands
Your Firebird

Install with a script or by hand

The script for Windows or Linux downloads the archive, copies the files and runs the tests. Or copy the files yourself and do the eight steps.

The eight steps
HQbird

Nothing to download

HQbird contains the server plugins, the client files and the utilities. You add the license file and the line KeyHolderPlugin = KeyHolder.

If HQbird is installed

Packages of 26.11.2026

Download

Prices

One archive has all you need: the server plugins, the client files for applications, the utilities and a test database.

The server part is 64-bit. The client part has 32-bit and 64-bit files: take the bitness of your application. The script run-tests.ps1 encrypts the test database, makes a backup and a restore, and checks the result.

FB_50_WINDOWS_64bit
├── Server                 extract into the Firebird root folder
│   ├── plugins            dbcrypt.dll, keyholder.dll, DbCrypt.conf (trial license)
│   ├── fbclient.dll, fbcrypt.dll, OpenSSL libraries
│   └── decrypt.exe
└── Client
    ├── 32bit, 64bit       client files and gbak, nbackup, isql, gfix
    │   ├── plugins        dbcrypt.dll, keyholder.dll, DbCrypt.conf
    │   └── key-plugins    KeySource.dll (test keys), keyholderstdin.dll
    └── db-crypt           EMPLOYEE.FDB and run-tests.ps1

The trial license DbCrypt.conf has a limited period. With a purchased license, replace this file and restart Firebird: the encrypted databases stay as they are.

From the guide, in short

Encryption in 8 steps

The full guide
  1. 1Installthe plugin files
  2. 2Configurelicense and KeyHolderPlugin
  3. 3Make a keyor a pass phrase
  4. 4EncryptALTER DATABASE
  5. 5Checkgstat -h
  6. 6Remove the keyfrom the server
  7. 7Give the keyto each application
  8. 8✓ Back upencrypted gbak

Each step is short. The link under a step opens the full chapter of the guide.

1

Install the plugin files

Stop the Firebird service. Extract the Server folder of the archive into the Firebird root folder. Some Firebird files are replaced.

Or use the installation script. It finds Firebird, downloads the archive, changes the configuration and runs the tests.

Windows, cmd as administrator:
install-Firebird-encryption-plugin.bat
Linux, into an installed Firebird:
sudo ./fb_vanilla-50.sh --crypt-only=/opt/firebird

Linux with Firebird 3.0 or 4.0 also needs the OpenSSL 1.1 library (libcrypto.so.1.1).

2

Put the license file and turn on the plugin

The license file DbCrypt.conf must be in the plugins folder. The archive has a trial license. Then turn on the key holder plugin and restart Firebird.

# firebird.conf: for all databases
KeyHolderPlugin = KeyHolder

# or databases.conf: for one alias
crypt = C:\Temp\EMPLOYEE.FDB
{
    KeyHolderPlugin = KeyHolder
}
3

Make a key

A key is 32 random bytes (AES-256). You can also use a pass phrase: the plugin calculates the key from it.

aesKeyGen.exe
or, without the utility:
openssl rand -hex 32 | sed 's/../0x&,/g'

For the first test, write the key into plugins/KeyHolder.conf on the server:

Key=Red 0xec,0xa1,0x52,0xf6, ... ,0x04,0xdc,0x75,
# or a pass phrase
Password=Red my long pass phrase

Keep a copy of the key in a safe place apart from the server. A lost key cannot be restored.

4

Encrypt the database

Make a backup first, and do the first test on a copy. Connect over TCP/IP: write the server name.

isql localhost:C:\Temp\EMPLOYEE.FDB -user SYSDBA -password masterkey
SQL> ALTER DATABASE ENCRYPT WITH "DbCrypt" KEY Red;
SQL> COMMIT;

The statement only starts the encryption. A background thread of the server encrypts the pages. You can work with the database during this time. Keep one connection open until the encryption is complete.

5

Check the result

The header must show the attribute encrypted and the key name. The switch -e counts the pages.

gstat -h EMPLOYEE.FDB
        Attributes              encrypted, plugin DbCrypt
        Encryption key name:    RED
gstat -e EMPLOYEE.FDB
Data pages: total 116, encrypted 116, non-crypted 0

Progress for a large database (the field is 0 when the encryption is complete):

select mon$crypt_page * 100.0 / mon$pages as percent from mon$database;
For the test the key is in a file on the server. After step 6 the server keeps no key, and each connection brings the key. STEPS 3–5: TEST. THE KEY IS IN A FILE STEPS 6–8: WORK. NO KEY ON THE SERVER plugins/KeyHolder.confKey=Red 0xec,0xa1,… · only for tests Firebird servereach client connects: good for the firstencryption, not for a stolen disk Application + key sourcefbcrypt · KeySource · input stream Firebird servera connection without the key getsthe error "Key not set" STEP 6
the key step 6: delete the file with the key and restart Firebird
6

Remove the key from the server

Delete or rename the file plugins/KeyHolder.conf with the key and restart Firebird. The server works without this file. Then check that a connection without the key fails:

isql localhost:C:\Temp\EMPLOYEE.FDB -user SYSDBA -password masterkey
Statement failed, SQLSTATE = 08006
Invalid crypt key RED
-Key not set

From this moment each connection must bring the key. The server does not share the key between connections.

7

Give the key to each application

Select the way for each program that connects to the database: the application, reports, services and backup jobs.

ProgramWay to send the keyFull description
Application without source codeKeySource.dll near fbclient.dllNo code changes · guide
Application with source code: Delphi, Lazarus, C++ and othersfbcrypt library: three calls before the connectionNative applications
Java (Jaybird) and .NETconnection property; needs UnsafeClient = true and wire encryptionJava · .NET
gbak, nbackup, isql, gfix, scriptsKeyHolderStdin plugin: the key comes from the input streamKeyHolderStdin
A person types the key or the pass phraseline Prompt in the client KeyHolder.confKey request to the user

The client must use fbclient and the plugins from the same package as the server. The bitness of the client files is the bitness of the application.

8

Make an encrypted backup

gbak encrypts the backup only with the switch -KeyHolder. Without this switch the .fbk file has the data in plain form.

Firebird 4.0 and 5.0: the key comes from a file with limited access
type C:\Secure\dbkey.txt | gbak -b localhost:D:\DB\app.fdb E:\Backup\app.fbk -KeyHolder KeyHolderStdin -user SYSDBA -password ********
check: an encrypted backup has no table names in plain text, so this prints nothing
findstr /m CUSTOMER E:\Backup\app.fbk

Near gbak there must be the plugins folder with DbCrypt, KeyHolder, KeyHolderStdin and the license file. An nbackup copy stays encrypted with the key of the database. Firebird 3.0 has different switches: -KEYFILE, -KEYNAME, -KEY.

Ready example

Try it in 10 minutes

The example on GitHub

The example does all eight steps for you on a separate test server. It downloads the official Firebird and the plugin package with a trial license. The application has no code for the key: it gets the key from KeySource.dll.

PS> git clone https://github.com/IBSurgeon/FirebirdEncryptionGuide
PS> cd FirebirdEncryptionGuide\examples\closed-gui\deploy
PS> .\05-download-example.ps1          # ready programs of the example
PS> .\run-all.ps1 -Version 5           # server, encrypted database, workstation folder
PS> ..\work\fb5\remote\EmployeeRemote.exe
PS> .\50-backup.ps1 -Version 5         # encrypted backup and a test restore
The example application opens the encrypted database. Its code has no key.

After the test

Tools and your applications

All examples on GitHub
  • Command-line utilitiesgbak, nbackup, isql and gfix from the folder Client have the switch -KeyHolder (Firebird 4.0 and 5.0).
  • Administration toolsA tool that loads fbclient.dll works as an application without source code: put the client files and a key source into its folder. Take the bitness of the tool.
  • TCP/IP connectionThe server asks the client for the key only on a TCP/IP connection. On XNET the key must be on the server.
  • Examples for your languageDelphi and Lazarus, Python, Java, .NET, PHP, C++: ready projects with a description. The list.
  • The same package everywhereClient and server libraries from different packages cannot exchange the key.
  • If something failsThe guide has a chapter with error messages and their causes: Troubleshooting. Or write to [email protected].

Documentation

Guides in four languages

Repository on GitHub
LanguageEncryption plugin guideApplications without source code
EnglishRead online · PDFRead online · PDF
Portuguese (Brazil)Read online · PDFRead online · PDF
PolishRead online · PDFRead online · PDF
GermanRead online · PDFRead online · PDF
RussianRead online · PDFRead online · PDF

The sources of the guides are in the same repository, folder doc. The PDF files are built from them for each release.