Crate keepass_db

source ·
Expand description

Read, modify and write KeePass 2.x databases

The main types used in this crate are:

  • Key which represents the composite key used to lock a database
  • KeePassDoc which represents the contents of an unlocked KeePass database

Opening a database:

use std::io::Error;
use keepass_db::{KeePassDoc, protected_stream::CipherValue, Key};
fn main() -> Result<(), Error> {
    let mut key = Key::new();
    key.set_user_password("asdf");
    let mut doc = KeePassDoc::load_file("testdata/dummy-kdbx41.kdbx", &key)?;
    let database = doc.file;
    let stream = &mut doc.cipher;
    let basic_entry = database.root_group().all_entries().filter(|e| e.url().unprotect(stream).unwrap() == "https://keepass.info/").last().unwrap();
    println!("Password: {}", basic_entry.password().unprotect(stream).unwrap());
    Ok(())
}

Modules

Structs

Enums

Constants

Traits

Functions