mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Key file implemented!
Key Derivation setting added More unit tests created Some cleanup in lib WIP Argon2 save
This commit is contained in:
@@ -54,10 +54,12 @@ namespace ModernKeePass.Common
|
||||
}
|
||||
}
|
||||
|
||||
public StorageFile KeyFile { get; set; }
|
||||
|
||||
public PwUuid DataCipher
|
||||
{
|
||||
get { return _pwDatabase.DataCipherUuid; }
|
||||
internal set { _pwDatabase.DataCipherUuid = value; }
|
||||
set { _pwDatabase.DataCipherUuid = value; }
|
||||
}
|
||||
|
||||
public PwCompressionAlgorithm CompressionAlgorithm
|
||||
@@ -66,6 +68,12 @@ namespace ModernKeePass.Common
|
||||
set { _pwDatabase.Compression = value; }
|
||||
}
|
||||
|
||||
public KdfParameters KeyDerivation
|
||||
{
|
||||
get { return _pwDatabase.KdfParameters; }
|
||||
set { _pwDatabase.KdfParameters = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open a KeePass database
|
||||
/// </summary>
|
||||
@@ -77,7 +85,8 @@ namespace ModernKeePass.Common
|
||||
var key = new CompositeKey();
|
||||
try
|
||||
{
|
||||
key.AddUserKey(new KcpPassword(password));
|
||||
if (password != null) key.AddUserKey(new KcpPassword(password));
|
||||
if (KeyFile != null) key.AddUserKey(new KcpKeyFile(IOConnectionInfo.FromFile(KeyFile)));
|
||||
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
|
||||
if (createNew) _pwDatabase.New(ioConnection, key);
|
||||
else _pwDatabase.Open(ioConnection, key, new NullStatusLogger());
|
||||
@@ -120,7 +129,7 @@ namespace ModernKeePass.Common
|
||||
public void Save()
|
||||
{
|
||||
// TODO: Save is disabled for now for Argon2Kdf because it corrupts DB (read works)
|
||||
if (_pwDatabase == null || !_pwDatabase.IsOpen /*|| KdfPool.Get(_pwDatabase.KdfParameters.KdfUuid) is Argon2Kdf*/) return;
|
||||
if (_pwDatabase == null || !_pwDatabase.IsOpen || KdfPool.Get(_pwDatabase.KdfParameters.KdfUuid) is Argon2Kdf) return;
|
||||
_pwDatabase.Save(new NullStatusLogger());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user