Coder Social home page Coder Social logo

tonyfinn / kdbx-rs Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 259 KB

Library to read, create and modify Keepass KDBX files (Mirror from Gitlab)

Home Page: https://crates.io/crates/kdbx-rs

License: GNU General Public License v3.0

Rust 99.25% Nix 0.75%

kdbx-rs's Introduction

KDBX-rs

Documentation | Repository | crates.io

Library for reading and writing KDBX libraries from Rust.

Example code

Obtaining an entry from the password database:

use kdbx_rs::{self, CompositeKey, Error};
fn main() -> Result<(), Error> {
    let file_path = "./res/test_input/kdbx4-argon2d.kdbx";
    let kdbx = kdbx_rs::open(file_path)?;
    let key = CompositeKey::from_password("kdbxrs");
    let unlocked = kdbx.unlock(&key)?;

    let password = unlocked.find_entry(|e| e.url() == Some("https://example.com"))
        .unwrap()
        .password();

    println!(password);
    Ok(())
}

Generating a new password database:

let mut database = Database::default();
database.set_name("My First Database");
database.set_description("Created with kdbx-rs");

let mut entry = Entry::default();
entry.set_password("password1");
entry.set_url("https://example.com");
entry.set_username("User123");

database.add_entry(Entry);

Saving a database to a file

let mut database = Database::default();
let kdbx = Kdbx::from_database(database);
kdbx.set_key(CompositeKey::from_password("foo123"))?;

let mut file = File::create("/tmp/kdbx-rs-example.kdbx")?;
kdbx.write(&mut file)?;

Comparison of Rust Keepass Libraries (as of May 2020)

kdbx-rs keepass-rs kdbx4 rust-kpdb rust-keepass
License GPLv3+ MIT MIT MIT/Apache ISC
Formats
.kdbx 4 Yes Read only Read only No No
.kdbx 3 Read only Read only No Yes No
.kdb No No No No Yes
Algorithms
KDFs
AES Yes Yes Yes Yes Yes
Argon 2 Yes Yes Yes No Yes
Database Ciphers
AES Yes Yes Yes Yes Yes
TwoFish Yes Yes No Yes No
Chacha20 Yes Yes Yes No No
Value Ciphers
Chacha20 Yes Yes Yes No No
Salsa20 Yes Yes Yes Yes No
Features
Memory protection No Yes No No Yes
Keyfile auth Yes Yes Yes Yes Yes
Windows auth No No No No No
KeepassXC OTPs No No No No No
Custom fields Yes Yes Yes No No
Entry History Yes No Yes Yes No

License

This crate is licensed under GPLv3.0 or later, see LICENSE.txt for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.