[kdbx] Custos v1.2 core: KeePass import (KDBX 3.1, 4) and export (KDBX 4), v0.8.0 #10
Reference in New Issue
Block a user
Delete Branch "feature/kdbx"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Custos v1.2 core: KeePass import and export (
docs/KDBX.md). Version 0.8.0.What
custos-kdbx(new crate), in two layers:Meta/Binaries(3.1).docs/KDBX.md:KP2A_URL*), both TOTP forms;custos-vault: items get optionalfolderandattachments(SecretBytes: wiped on drop, never printed,base64 in the JSON). An item without them serializes exactly as before.
aes,cbc,chacha20,salsa20,hmac,sha2,argon2(RustCrypto);flate2;roxmltreewith DTDs off.Why its own reader instead of the
keepasscratewhat is said to be lost.
Tests (all pass, debug and release)
format.rs(14): every cipher × KDF round trip; wrong password and no key; four spellings of one key fileopen each other's files; one changed byte anywhere and truncation at every length both fail with the
right error and never panic; out-of-limit KDF parameters refused in well under a second; billion laughs,
XXE, deep nesting, broken XML, a gzip bomb (600 MiB →
TooLarge), Salsa20 in KDBX 4, Twofish and unknownversions refused; no secret in any
Debug.keepassxc.rs(3): two files KeePassXC 2.7.12 wrote (base64 test vectors, passwordcustos-test): a KDBX3.1 from
keepassxc-cli importand a KDBX 4.0 frommergeinto a Custos file. Both map exactly to whattools/kdbx/sample.xmlput in them.mapping.rs(5): every item type round-trips field by field; a KeePass-style database maps as tabled.tools/kdbx/interop.sh: run in WSL withkeepassxc-cli2.7.12 from nixpkgs.compare.pyon both XML exports: 0 differences (3 and 4 entries).attachment-export).TOTP Seed/TOTP Settings.Self-review
.kdbxdo? Every length is bounds-checked (Cur::take).before
StreamStartBytessays "wrong key". That is the format's weakness, not ours. The cap keeps it bounded.Zeroizing. roxmltree'sunescaped text copies (for unprotected values) are ordinary strings; THREAT_MODEL already says copies remain
where parsers move buffers.
tests/data/keepassxc_files.rsholds two small KeePassXC files (≈3 KB each) as base64 in asource file. They are test data, not build output;
interop.shmakes new ones.KeePassXC GUI files with Argon2d (the CLI writes AES-KDF/3.1). The reader handles Argon2d (round-trip tested),
but no Argon2d file from KeePassXC is in the vectors.
folderandattachmentsneverreach the page.