Decrypt DBeaver's credentials-config.json file and display the output (a JSON string).
This project ships in six flavours so you can use it in whichever language or shell suits you:
- Python module (
pip install dbeaver-creds) - importable asdbeaver_credsand exposes adbeaver-credsconsole script. C-extension under the hood, no external dependencies on your machine. - Native CLI binary built from this source tree via CMake. Single static binary, no runtime dependencies beyond the chosen crypto backend (CommonCrypto on macOS, BCrypt on Windows, OpenSSL on Linux).
- C library (
#include <dbeaver-creds.h>) - linkdbeaver_creds_core.aand callget_dbeaver_credentials(path). - Bash script that works on Linux, macOS, and Windows. Requires
opensslandddto be inPATH. - PowerShell module
(DBeaverCreds)
exposing
Show-DBeaver-Credential-Json(aliasdbeaver-creds). Pure .NET; no external dependencies. - Batch script (Windows only) equivalent to the Bash script with the
same
openssl+ddrequirements.
pip install dbeaver-credscmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --install buildDBEAVER_CREDS_BACKEND=native|openssl (passed via -D) overrides the auto-detected backend
(native = CommonCrypto on macOS / BCrypt on Windows; openssl =
cross-platform).
Place dbeaver-creds (or dbeaver-creds.bat) in PATH.
Install-Module -Name DBeaverCredsAll entry points accept an optional path argument; if absent, the platform-default credentials path is used. If the credentials file cannot be read, the exit status is non-zero.
dbeaver-creds [PATH]from dbeaver_creds import get_dbeaver_credentials
print(get_dbeaver_credentials()) # default path
print(get_dbeaver_credentials('/some/where.json')) # explicitOr use the console script installed by pip:
dbeaver-creds [PATH]
python -m dbeaver_creds [PATH]#include <dbeaver-creds.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
enum dbeaver_credentials_error err = DBEAVER_CREDENTIALS_OK;
char *json = get_dbeaver_credentials(NULL, &err); // pass a literal path or NULL
if (!json) {
fprintf(stderr, "dbeaver-creds failed: %d\n", err);
return 1;
}
puts(json);
free(json);
return 0;
}Show-DBeaver-Credential-Json
# Or the alias:
dbeaver-creds
# With an explicit path:
Show-DBeaver-Credential-Json -Path 'C:\custom\credentials-config.json'Requirements:
- Bash
- GNU sed
- Perl
- Yarn
- curl
- cut
- grep
- tr
The decryption key is from the DBeaver source.
It can be converted to hexadecimal like so in Python:
import struct
as_hex = struct.pack('<16b', 0, 1, 2, etc).hex()update-key.sh demonstrates conversion using shell script.
yarn format: to format the project's files.yarn qa: Perform a QA check.yarn update-keyorupdate-key.sh: update the key indbeaver-creds.