Skip to content

TimothyByrd/KeePassNetStandard

Repository files navigation

KeePassNetStandard

A port of the KeePassLib code of KeePass (v2.57) to .Net Standard.

Tags for previous versions of the port: v2.47, v2.48, v2.48.1, v2.49

Table of contents

Why?
GPL
How to use it
How it was ported, what's missing?
Links
Donation

Why?

I wanted to be able to read passwords from a KeePass database from a .Net Core app. The author/maintainer of KeePass is not interested in moving his codebase in that direction. I found another port but it was of the code from a few years ago.

The alternative I've seen is to call a powershell script from C#, where the script does a command-line invocation of KeePass.exe. I wanted someting less hacky than that.

GPL

The KeePass source code is licensed under GPL v2, so this code must be also.

Per this FAQ, this source can be used for internal applications that will not be distributed.

And this FAQ would apply to using the code on the backend of a web site.

I still would avoid putting any of this code into an internal source control, though.

How to use it

Get the source, build the KeePassNetStandard and KeePassLib project and use in your code.

If you just want to read passwords from a password database secured by a master password, I recommend using the methods in KeePassNetStandard.KeePassUtilities:

using KeePassNetStandard;

static void Main()
{
    var db = KeePassUtilities.OpenPasswordDatabase(pathToKdbx, masterPassword);
    var somePassword = db.GetPassword("SomeGroupName", "TheEntryTitle", "TheUserName");
}

See the QuickTest project in the solution for more info.

Otherwise, the functionality of KeePassLib is available.

In general, the changes are minimal to make it easier to update as the main KeePass source changes.

I followed the same methods as Strangelovian in KeePass2Core. All code changes can be found by searching for NETSTANDARD2_0. Also see KeePassLib.csproj for files removed from compilation.

Some things have been #if-ed out, notably UI code down in the core library. (The sort of things that are okay in a one-man project, but wouldn't pass code review in a team setting.)

Note that the assembly in this project is not signed.

The code I added in KeePassNetStandard.KeePassUtilities has XML documentation to make it easier to use.

Please let me know if something is broken or if there are some other tests I should add to the QuickTest project.

Links

  • Thanks to KeePass for making something useful enough that people want to use it beyond your vision.
  • Thanks to Strangelovian for showing it was possible to port in KeePass2Core.

Donation

If this project helped you, you can help me :)

paypal

About

A port of the KeePassLib code of KeePass to .Net Standard.

Topics

Resources

License

Stars

Watchers

Forks

Languages