10 min read

KeePass compatible password manager in Rust that also guards your LLM keys

KeePass compatible password manager in Rust that also guards your LLM keys
Read aloud by your browser. Nothing is downloaded.

Part of Software Development & Tools — the development stack: environments, APIs and tooling.

✅ REAL DATA — LLM Vault 0.1.0 release build · Rust 1.99, keepass-rs 0.17, Slint 1.18 · vault files verified with an independent KDBX reader · timings from 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.

Key takeaways
  • 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.

LLM Vault password manager view with groups, logins and gateway-managed provider keys
Ordinary logins and gateway-managed provider keys share one vault. Provider keys carry a tag and a “gateway key” badge.

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.

LayerAlgorithmSetting in LLM Vault
Key derivationArgon2id (KDBX KDF)64 MiB memory, 5 iterations, parallelism 4
Outer encryptionAES-256-CBCFresh IV and master seed on every save
IntegrityHMAC-SHA-256 per blockA modified byte makes the file fail to open
Protected fieldsChaCha20 inner streamPasswords and API keys
CompressionGZip200 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.

LLM Vault sign-up screen for a new profile with user name, display name and login password fields
Creating a profile. The vault itself is created in the next step with its own master password.

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:

OperationTime
Create a new vault319 ms
Unlock (5 runs)360, 335, 325, 326, 340 ms
Reject a wrong password313 ms
Save a vault with 200 entries340 ms
200 sequential edits, each savedabout 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 ZIP19.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.

LLM Vault settings with gateway address, auto-lock, clipboard timeout, currencies and vault file information
Security-relevant settings, such as the gateway address and auto-lock, are stored inside the encrypted vault.

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.

Did this article help?
Artur Poniedziałek
Artur Poniedziałek
IT Expert & Project Manager
🤖 AI ⚡ PM 🐍 Python 🖥️ Local AI

IT Expert & Project Manager with 15+ years of experience. Exploring practical AI applications — from local LLMs and RAG systems to workflow automation. Writing to share knowledge and inspire others to experiment with new technologies.

Leave a Reply

Your email address will not be published. Required fields are marked *