ModernKeePassLib is a port of KeePassLib to .netstandard 1.2, distributed as a nuget package. The aim was to change as little as possible the original library. However, some workarounds have to be made as .netstandard 1.2 misses quite a few features of the full .net framework. Main changes:
- Removed the dependency on the filesystem
- Added a dependency on Windows (I'm working on tring to find a way to remove it altogether)
- Some features are handled by external nuget packages (cryptography, colors, etc.), so it may introduce small differences
From nuget.org
- Create a IOConnectionInfo from a byte array:
var ioConnection = IOConnectionInfo.FromByteArray(file);
- Create a composite key and add credential information:
var compositeKey = new CompositeKey(); // Password compositeKey.AddUserKey(new KcpPassword("Password"));
// Key file compositeKey.AddUserKey(new KcpKeyFile(IOConnectionInfo.FromByteArray(KeyFileContents)));` - Use it to open the database:
// You may use whatever logger you choose (here, I use nullstatuslogger)
PwDatabase.Open(ioConnection, compositeKey, new NullStatusLogger());
- Do stuff in you database (create entries, groups, ...)
- Save your changes:
PwDatabase.Save(new NullStatusLogger());
- At this point, nothing is commited to disk, so you need to retrieve the byte array:
var contents = PwDatabase.IOConnectionInfo.Bytes;
- Write the byte array to a file, to a stream, whatever !
- Remove Windows dependencies entirely
- Find a way to use Color class (handled by Splat at the moment, but I'm not satisfied)