Part of Software Development & Tools — the development stack: environments, APIs and tooling.
tests/kdf_timing.rs · Windows 11 · AMD Radeon PRO W7900 workstation.
A KeePass compatible password manager does not need a new file format. In this article I show how LLM Vault stores logins, passwords and LLM provider keys in a standard KDBX 4.1 file, written in Rust. The same file opens in KeePass and KeePassXC. On top of it sits a gateway that lets AI agents use the keys without ever reading them. I cover the format, the measured unlock time, the design decisions and the trade-offs behind them.
- LLM Vault writes KDBX 4.1 with AES-256, Argon2id (64 MiB, 5 iterations, parallelism 4) and ChaCha20 for protected fields.
- An independent KDBX reader opened the file and rejected a wrong password with
CredentialsError. - Unlocking takes 325–360 ms in a release build; a wrong password fails after 313 ms.
- Gateway configuration lives inside the encrypted file, so an agent cannot redirect a provider URL to steal a key.
- Sign-in profiles and the vault master password are separate, and neither has a reset: you change a password only by knowing the current one.
Why build a KeePass compatible password manager
The first design question was the storage format. Admittedly, a custom format would have been easier to write, yet it would also be harder to trust. KDBX, in contrast, has been reviewed for years, and many independent apps implement it.
Compatibility gives users three concrete benefits. First, they can open an existing KeePass database in LLM Vault and keep their current workflow. Second, they can open an LLM Vault file in KeePassXC or KeePassDX if they ever stop using it. Third, an auditor can inspect the file with tools that have nothing to do with this project.
The project itself is the gateway described in the AI agent API key security article. Agents receive a client token, and the vault performs model calls on their behalf. Consequently, the vault must be a real password manager first, with groups, logins, notes and a generator, and an LLM tool second.

What makes the password manager KeePass compatible
LLM Vault relies on the keepass crate for reading and writing KDBX. The crate’s defaults were not what I wanted, so the vault sets its own key derivation parameters.
| Layer | Algorithm | Setting in LLM Vault |
|---|---|---|
| Key derivation | Argon2id (KDBX KDF) | 64 MiB memory, 5 iterations, parallelism 4 |
| Outer encryption | AES-256-CBC | Fresh IV and master seed on every save |
| Integrity | HMAC-SHA-256 per block | A modified byte makes the file fail to open |
| Protected fields | ChaCha20 inner stream | Passwords and API keys |
| Compression | GZip | 200 entries produced an 11,969-byte file |
For reference, RFC 9106 recommends Argon2id with 64 MiB, 3 iterations and 4 lanes for memory-constrained systems. LLM Vault keeps the memory and lanes but uses 5 iterations, so it sits above that floor. The file layout itself follows the KDBX 4.1 specification that KeePass 2.48 introduced.
Above all, the key derivation setting is the one that matters for brute force. Each guess costs an attacker 64 MiB of memory and the same 0.3 s my machine needs. In code, the setting is a single enum value:
// Production KDF: memory-hard, so GPUs gain little per guess.
KdfConfig::Argon2id {
iterations: 5,
memory: 64 * 1024 * 1024, // bytes in KDBX, 64 MiB
parallelism: 4,
version: argon2::Version::Version13,
}
Keeping gateway config inside the KeePass compatible password file
The most interesting decision is where gateway settings live. Provider URLs, model aliases, client token hashes, consent rules and prices could go into a JSON file in the user profile. However, that file would be the weakest link.
Here is the attack. An agent edits the settings file and changes the “Azure AI Foundry” base URL to a server it controls. The next approved request then carries the real key in its header to the attacker. No secret endpoint was needed.
Therefore, LLM Vault stores the whole configuration inside the encrypted KDBX file, in the database’s custom data. The HMAC covers it, so tampering breaks the file instead of redirecting traffic. KeePass ignores unknown custom data, so compatibility stays intact:
// Gateway configuration is saved with the secrets, under the same encryption and HMAC.
let json = serde_json::to_string(&self.config)?;
self.db.meta.custom_data.insert(
"llmvault.config.v1".to_string(),
CustomDataItem { value: Some(CustomDataValue::String(json)),
last_modification_time: Some(Times::now()) });
Two more rules close the loop. The HTTP client never follows redirects, and remote providers must use HTTPS. In addition, saves are atomic: the vault writes a temporary file, syncs it, keeps the previous version as .bak and only then renames.
Profiles, master passwords and no reset
LLM Vault separates two states on purpose. A user signs in to the application, yet the vault can still be locked. LLM Vault implements that literally.
Free ebook
Free AI Video, Generated Locally
Working scripts and measured benchmarks. Free.
No spam. Unsubscribe at any time.
A profile has a user name and a login password, stored as an Argon2id hash in profiles.json. Each profile owns its own folder with vaults, the audit database and settings. As a result, two people or two roles on one workstation do not see each other’s activity.
By contrast, the vault master password is separate. It derives the KDBX key, and it never touches the profile file.

Notably, neither password has a reset. Changing either one requires the current password. If a user forgets the login password, the only path is to delete the profile and create a new one, after typing the profile name to confirm. At first, that sounds harsh. Still, a reset function is a backdoor, and a password manager with a backdoor is not one.
Keeping secrets short-lived in memory
However, encryption at rest is only half of the job. While the vault is unlocked, decrypted values sit in memory, so their lifetime matters.
Protected KDBX values are held in zeroize-on-drop containers. When the user locks the vault, signs out or stays idle for 15 minutes, the decrypted database is dropped and its secrets are overwritten. Similarly, the gateway resolves a provider key only after all policy checks pass, and the key leaves memory when the request finishes.
In addition, the clipboard is another quiet leak. On Windows, copied passwords would normally land in clipboard history and could sync to the cloud. LLM Vault excludes them and clears the clipboard after 15 seconds, but only if it still holds the copied value:
// Copy a password without leaving it in Windows clipboard history or cloud sync.
cb.set().exclude_from_history().exclude_from_cloud()
.exclude_from_monitoring().text(value.as_str())
Verifying the KeePass compatible password file
A writer should never be verified only by its own reader. Therefore, open a vault produced by LLM Vault with pykeepass, an independent Python implementation:
from pykeepass import PyKeePass
kp = PyKeePass("DEMO - LLM Vault.kdbx", password="demo-vault-password-2026")
print(kp.version, kp.encryption_algorithm) # (4, 1) aes256
print(len(kp.entries)) # 12
Groups, entries, user names and passwords all came back intact. Likewise, provider keys carried their llmvault-provider tag. Finally, a wrong password raised CredentialsError.
Why pykeepass shows “KDF: None”
pykeepass maps only some KDF identifiers to names, so it reports kdf_algorithm as None for this file. The raw header shows the Argon2id UUID 9e298b19-56db-4773-b23d-fc3ec6f0a1e6 with 64 MiB, 5 iterations and parallelism 4. In other words, check the UUID before you suspect a broken header.
Unlock time of a KeePass compatible password manager
Memory-hard derivation has a price, and it shows up in two places. These numbers come from a release build:
| Operation | Time |
|---|---|
| Create a new vault | 319 ms |
| Unlock (5 runs) | 360, 335, 325, 326, 340 ms |
| Reject a wrong password | 313 ms |
| Save a vault with 200 entries | 340 ms |
| 200 sequential edits, each saved | about 70 s in total |
The last row is the lesson. Every edit re-encrypts the file with a fresh key derivation, which is correct but slow for bulk operations. For a person editing one entry, 0.34 s is invisible. For an import of 200 entries, however, the vault must batch the changes and save once, which the KeePass import path already does.
The debug-build trap
In a debug build, Argon2 with 64 MiB is painfully slow, because the hashing code runs without optimizations. The fix is one profile entry that optimizes dependencies even in debug builds:
[profile.dev.package."*"]
opt-level = 2
What the design does not protect against
A good vault states its limits plainly. So here is what KDBX encryption and in-memory hygiene cannot do.
First, malware running as your user while the vault is unlocked can read process memory or take screenshots. Zeroization shortens the exposure window; it does not close it. Second, a keylogger captures the master password regardless of the file format. Third, a weak master password defeats Argon2id eventually, because 0.3 s per guess still allows millions of guesses on a cluster. For that reason, the create dialog refuses passwords below about 50 bits of estimated entropy.
Consequently, the gateway offers a stronger deployment for teams that run autonomous agents. The headless llmvault-server runs the same vault on a separate VM or under a separate OS account. Agents then reach only the HTTP endpoint, never the process that holds the keys. In practice, that is the only setup that holds up against a terminal-capable agent with full user rights.
A KeePass compatible password manager as a single binary
Overall, the whole application is one native executable with a Slint user interface. There is no browser, no Node.js and no Python runtime. Installers come from one script per OS.
| Artefact (Windows x64) | Size |
|---|---|
llmvault.exe (desktop app) | 36.4 MB |
llmvault-server.exe (headless gateway) | 11.6 MB |
| Installer (Inno Setup, per-user, no admin rights) | 13.0 MB |
| Portable ZIP | 19.4 MB |
The uninstaller removes the program but keeps profiles and vaults, unless the user explicitly chooses otherwise. Moreover, a portable build keeps everything in a data folder next to the executable.

Frequently asked questions
Can I open my existing KeePass database in LLM Vault?
Yes. LLM Vault opens KDBX 3 and 4 files, and it saves in KDBX 4.1. You can also import entries from another database into a new group.
Will KeePassXC show the LLM gateway settings?
No. The settings live in the database’s custom data, which KeePass apps preserve but do not display. Provider keys appear as normal entries in the “LLM Providers” group.
Does LLM Vault support key files?
Yes. You can combine the master password with a KeePass key file when you create or unlock a vault. Changing the master password keeps the key file requirement.
Why is there no password reset?
Because a reset is a second way in. You can change a password when you know the current one; otherwise, you delete the profile and start again.
How long does unlocking take?
About 0.33 s on my workstation with Argon2id at 64 MiB and 5 iterations. Slower laptops take longer, which is the point of a memory-hard KDF.
Is the code open source?
Yes, under Apache-2.0. The UI uses Slint under its royalty-free license, and KDBX handling uses the MIT-licensed keepass crate.
Summary
A KeePass compatible password manager can carry much more than passwords. LLM Vault stores logins and LLM provider keys in a standard KDBX 4.1 file with AES-256, Argon2id at 64 MiB and ChaCha20-protected fields. An independent reader opened it without trouble. Unlocking takes 325–360 ms, and the gateway configuration lives inside the same encrypted, HMAC-checked file. Sign-in profiles and master passwords stay separate, and neither has a reset. To see the gateway in action with local models, read the local LLM gateway measurements.
LLM Vault itself is free and open source. The installer, the portable version and the example scripts from the videos are on the LLM Vault download page.
The download bundle keepass-compatible-password-manager-rust.zip contains the vault module, the timing test, the KDBX verification script and the measured results.
Companion code — the fragments above are the working parts: the Argon2id parameters, the line that stores gateway configuration inside the encrypted file, the clipboard call that skips Windows history and the independent compatibility check.
Free ebook
Free AI Video, Generated Locally
Run Wan 2.1 in ComfyUI on your own GPU — the scripts I use, measured times, sample clips. No cloud, no API keys.
No spam. Unsubscribe at any time.


Leave a Reply