13 Commits
V1.6 ... V1.8

Author SHA1 Message Date
BONNEVILLE Geoffroy
abb12accc7 Correct two bugs related to key file opening
Bettter error messages with composite key
Show an error message if save has failed and don't close the database
2017-11-13 11:28:14 +01:00
2779e5b7c7 Updated README.md 2017-11-09 16:54:43 +00:00
3970d485f6 Updated README.md 2017-11-09 16:53:47 +00:00
BONNEVILLE Geoffroy
7b888cc4a2 Merge branch 'master' of https://geogeob.visualstudio.com/_git/ModernKeePass 2017-11-09 13:46:15 +01:00
BONNEVILLE Geoffroy
117513d6bf Correct credits in About 2017-11-09 13:46:10 +01:00
97511ab290 Updated README.md 2017-11-09 12:43:41 +00:00
3131eca8a1 Updated README.md 2017-11-09 12:39:55 +00:00
91a5507217 Added file README.md 2017-11-09 11:16:13 +00:00
7d904b7120 Updated README.md 2017-11-09 11:08:46 +00:00
BONNEVILLE Geoffroy
be72fc4f7e Minor change for Designer 2017-11-08 18:52:48 +01:00
BONNEVILLE Geoffroy
ecba11a9a9 Version 1.7 - only difference with 1.6 is Argon2Kdf fully working 2017-11-08 18:01:50 +01:00
BONNEVILLE Geoffroy
65f2e529f4 Argon2KDF write mode works! (thanks to an option in XMLWriterSettings) 2017-11-08 17:52:00 +01:00
BONNEVILLE Geoffroy
29e7b22953 Ignored useless files 2017-11-08 17:17:11 +01:00
23 changed files with 140 additions and 78 deletions

4
.gitignore vendored
View File

@@ -36,4 +36,6 @@ Translation/TrlUtil.vshost.exe.manifest
/UpgradeLog*.htm /UpgradeLog*.htm
packages/ packages/
project.lock.json project.lock.json
AppPackages/ AppPackages/
BundleArtifacts/
*.DotSettings

View File

@@ -1,4 +0,0 @@
MainPackage=C:\Users\GBE\Source\Repos\ModernKeePass\ModernKeePass\bin\Release\ModernKeePassApp_1.6.0.27_AnyCPU.appx
SymbolPackage=C:\Users\GBE\Source\Repos\ModernKeePass\ModernKeePass\AppPackages\ModernKeePassApp_1.6.0.27_Test\ModernKeePassApp_1.6.0.27_AnyCPU.appxsym
ResourcePack=C:\Users\GBE\Source\Repos\ModernKeePass\ModernKeePass\bin\Release\ModernKeePassApp_1.6.0.27_scale-140.appx
ResourcePack=C:\Users\GBE\Source\Repos\ModernKeePass\ModernKeePass\bin\Release\ModernKeePassApp_1.6.0.27_scale-180.appx

View File

@@ -14,6 +14,9 @@ namespace ModernKeePass.Common
{ {
public enum DatabaseStatus public enum DatabaseStatus
{ {
Error = -3,
NoCompositeKey = -2,
CompositeKeyError = -1,
Closed = 0, Closed = 0,
Opening = 1, Opening = 1,
Opened = 2 Opened = 2
@@ -77,11 +80,11 @@ namespace ModernKeePass.Common
/// <param name="key">The database composite key</param> /// <param name="key">The database composite key</param>
/// <param name="createNew">True to create a new database before opening it</param> /// <param name="createNew">True to create a new database before opening it</param>
/// <returns>An error message, if any</returns> /// <returns>An error message, if any</returns>
public string Open(CompositeKey key, bool createNew = false) public void Open(CompositeKey key, bool createNew = false)
{ {
try try
{ {
if (key == null) return "No composite key"; if (key == null) Status = DatabaseStatus.NoCompositeKey;
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile); var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
if (createNew) _pwDatabase.New(ioConnection, key); if (createNew) _pwDatabase.New(ioConnection, key);
else _pwDatabase.Open(ioConnection, key, new NullStatusLogger()); else _pwDatabase.Open(ioConnection, key, new NullStatusLogger());
@@ -92,19 +95,14 @@ namespace ModernKeePass.Common
RootGroup = new GroupVm(_pwDatabase.RootGroup, null, RecycleBinEnabled ? _pwDatabase.RecycleBinUuid : null); RootGroup = new GroupVm(_pwDatabase.RootGroup, null, RecycleBinEnabled ? _pwDatabase.RecycleBinUuid : null);
} }
} }
catch (ArgumentNullException)
{
return "Password cannot be empty";
}
catch (InvalidCompositeKeyException) catch (InvalidCompositeKeyException)
{ {
return "Wrong password"; Status = DatabaseStatus.CompositeKeyError;
} }
catch (Exception ex) catch (Exception ex)
{ {
return ex.Message; Status = DatabaseStatus.Error;
} }
return string.Empty;
} }
/// <summary> /// <summary>
@@ -121,11 +119,19 @@ namespace ModernKeePass.Common
/// <summary> /// <summary>
/// Commit the changes to the currently opened database to file /// Commit the changes to the currently opened database to file
/// </summary> /// </summary>
public void Save() public bool Save()
{ {
// TODO: Save is disabled for now for Argon2Kdf because it corrupts DB (read works) if (_pwDatabase == null || !_pwDatabase.IsOpen) return false;
if (_pwDatabase == null || !_pwDatabase.IsOpen || KdfPool.Get(KeyDerivation.KdfUuid) is Argon2Kdf) return; try
_pwDatabase.Save(new NullStatusLogger()); {
_pwDatabase.Save(new NullStatusLogger());
return true;
}
catch (Exception ex)
{
MessageDialogHelper.ShowErrorDialog(ex);
}
return false;
} }
/// <summary> /// <summary>

View File

@@ -23,5 +23,17 @@ namespace ModernKeePass.Common
// Show the message dialog // Show the message dialog
await messageDialog.ShowAsync(); await messageDialog.ShowAsync();
} }
public static async void ShowErrorDialog(Exception exception)
{
// Create the message dialog and set its content
var messageDialog = new MessageDialog(exception.Message, "Error occured");
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
messageDialog.Commands.Add(new UICommand("OK"));
// Show the message dialog
await messageDialog.ShowAsync();
}
} }
} }

View File

@@ -47,7 +47,7 @@
Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushConverter}}" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushConverter}}"
Visibility="{Binding ShowComplexityIndicator, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" /> Visibility="{Binding ShowComplexityIndicator, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" />
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" /> <CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" />
<HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0" Content="Select key file from disk..." IsEnabled="{Binding HasKeyFile}" Click="KeyFileButton_Click" /> <HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0" Content="{Binding KeyFileText}" IsEnabled="{Binding HasKeyFile}" Click="KeyFileButton_Click" />
<Button Grid.Column="0" Grid.Row="2" Content="OK" Click="OpenButton_OnClick" Background="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}" Foreground="{ThemeResource TextBoxBackgroundThemeBrush}" IsEnabled="{Binding IsValid}" /> <Button Grid.Column="0" Grid.Row="2" Content="OK" Click="OpenButton_OnClick" Background="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}" Foreground="{ThemeResource TextBoxBackgroundThemeBrush}" IsEnabled="{Binding IsValid}" />
<TextBlock Grid.Column="1" Grid.Row="2" Height="28" FontSize="14" FontWeight="Light" HorizontalAlignment="Right" Text="{Binding Status}" Foreground="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" /> <TextBlock Grid.Column="1" Grid.Row="2" Height="28" FontSize="14" FontWeight="Light" HorizontalAlignment="Right" Text="{Binding Status}" Foreground="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" />
</Grid> </Grid>

View File

@@ -3,7 +3,6 @@ using Windows.Storage.Pickers;
using Windows.System; using Windows.System;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Input;
using ModernKeePass.Common;
using ModernKeePass.Events; using ModernKeePass.Events;
using ModernKeePass.ViewModels; using ModernKeePass.ViewModels;
@@ -56,7 +55,7 @@ namespace ModernKeePass.Controls
ValidationChecking?.Invoke(this, new EventArgs()); ValidationChecking?.Invoke(this, new EventArgs());
if (UpdateKey) Model.UpdateKey(); if (UpdateKey) Model.UpdateKey();
else if (Model.OpenDatabase(CreateNew) == DatabaseHelper.DatabaseStatus.Opened) else if (Model.OpenDatabase(CreateNew))
{ {
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup)); ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
} }
@@ -78,7 +77,9 @@ namespace ModernKeePass.Controls
picker.FileTypeFilter.Add(".key"); picker.FileTypeFilter.Add(".key");
// Application now has read/write access to the picked file // Application now has read/write access to the picked file
Model.KeyFile = await picker.PickSingleFileAsync(); var file = await picker.PickSingleFileAsync();
if (file == null) return;
Model.KeyFile = file;
} }
} }
} }

View File

@@ -1,3 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp70</s:String>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=viewmodels_005Citems/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -297,7 +297,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.37.5000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath> <HintPath>..\packages\ModernKeePassLib.2.37.6000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">

View File

@@ -1,3 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp70</s:String>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=viewmodels_005Citems/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest"> <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.6.0.27" /> <Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.8.0.28" />
<Properties> <Properties>
<DisplayName>ModernKeePass</DisplayName> <DisplayName>ModernKeePass</DisplayName>
<PublisherDisplayName>wismna</PublisherDisplayName> <PublisherDisplayName>wismna</PublisherDisplayName>

View File

@@ -32,7 +32,7 @@
<Run Text="Dominik Reichl for the KeePass application and file format"/> <Run Text="Dominik Reichl for the KeePass application and file format"/>
</TextBlock> </TextBlock>
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="30,0,0,0"> <TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="30,0,0,0">
<Run Text="ArtjomP for his PCL adapatation of the KeePass Library"/> <Run Text="David Lechner for his PCL adapatation of the KeePass Library and his correlated tests"/>
</TextBlock> </TextBlock>
</StackPanel> </StackPanel>
</Page> </Page>

View File

@@ -24,6 +24,6 @@
<TextBlock Text="Compression Algorithm" FontSize="14" Margin="5,20,0,10" /> <TextBlock Text="Compression Algorithm" FontSize="14" Margin="5,20,0,10" />
<ComboBox ItemsSource="{Binding Source={StaticResource Compressions}}" SelectedItem="{Binding CompressionName, Mode=TwoWay}" /> <ComboBox ItemsSource="{Binding Source={StaticResource Compressions}}" SelectedItem="{Binding CompressionName, Mode=TwoWay}" />
<TextBlock Text="Key Derivation Algorithm" FontSize="14" Margin="5,20,0,10" /> <TextBlock Text="Key Derivation Algorithm" FontSize="14" Margin="5,20,0,10" />
<ComboBox ItemsSource="{Binding Source={StaticResource KeyDerivations}}" SelectedItem="{Binding KeyDerivationName, Mode=TwoWay}" IsEnabled="False" /> <ComboBox ItemsSource="{Binding Source={StaticResource KeyDerivations}}" SelectedItem="{Binding KeyDerivationName, Mode=TwoWay}" />
</StackPanel> </StackPanel>
</Page> </Page>

View File

@@ -24,6 +24,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.0")] [assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]

View File

@@ -1,4 +1,5 @@
using Windows.Storage; using System.Text;
using Windows.Storage;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using ModernKeePass.Common; using ModernKeePass.Common;
using ModernKeePassLib.Cryptography; using ModernKeePassLib.Cryptography;
@@ -24,6 +25,7 @@ namespace ModernKeePass.ViewModels
private string _status; private string _status;
private StatusTypes _statusType; private StatusTypes _statusType;
private StorageFile _keyFile; private StorageFile _keyFile;
private string _keyFileText = "Select key file from disk...";
public bool HasPassword public bool HasPassword
{ {
@@ -45,7 +47,7 @@ namespace ModernKeePass.ViewModels
} }
} }
public bool IsValid => HasPassword || HasKeyFile; public bool IsValid => HasPassword || HasKeyFile && KeyFile != null;
public string Status public string Status
{ {
@@ -76,18 +78,37 @@ namespace ModernKeePass.ViewModels
set set
{ {
_keyFile = value; _keyFile = value;
UpdateStatus($"Key file: {value.Name}", StatusTypes.Normal); KeyFileText = value?.Name;
OnPropertyChanged("IsValid");
} }
} }
public string KeyFileText
{
get { return _keyFileText; }
set { SetProperty(ref _keyFileText, value); }
}
public GroupVm RootGroup { get; set; } public GroupVm RootGroup { get; set; }
public double PasswordComplexityIndicator => QualityEstimation.EstimatePasswordBits(Password?.ToCharArray()); public double PasswordComplexityIndicator => QualityEstimation.EstimatePasswordBits(Password?.ToCharArray());
public DatabaseHelper.DatabaseStatus OpenDatabase(bool createNew) public bool OpenDatabase(bool createNew)
{ {
UpdateStatus(_app.Database.Open(CreateCompositeKey(), createNew), StatusTypes.Error); _app.Database.Open(CreateCompositeKey(), createNew);
RootGroup = _app.Database.RootGroup; switch (_app.Database.Status)
return _app.Database.Status; {
case DatabaseHelper.DatabaseStatus.Opened:
RootGroup = _app.Database.RootGroup;
return true;
case DatabaseHelper.DatabaseStatus.CompositeKeyError:
var errorMessage = new StringBuilder("Error: wrong ");
if (HasPassword) errorMessage.Append("password");
if (HasPassword && HasKeyFile) errorMessage.Append(" or ");
if (HasKeyFile) errorMessage.Append("key file");
UpdateStatus(errorMessage.ToString(), StatusTypes.Error);
break;
}
return false;
} }
public void UpdateKey() public void UpdateKey()

View File

@@ -91,7 +91,7 @@ namespace ModernKeePass.ViewModels
public SettingsDatabaseVm() public SettingsDatabaseVm()
{ {
Groups = _app.Database.RootGroup.Groups; Groups = _app?.Database.RootGroup.Groups;
} }
// TODO: Move to another setting class (or a static class) // TODO: Move to another setting class (or a static class)

View File

@@ -8,9 +8,7 @@ namespace ModernKeePass.ViewModels
public void Save(bool close = true) public void Save(bool close = true)
{ {
var app = (App)Application.Current; var app = (App)Application.Current;
app.Database.Save(); if (close && app.Database.Save()) app.Database.Close();
if (!close) return;
app.Database.Close();
} }
internal void Save(StorageFile file) internal void Save(StorageFile file)

View File

@@ -4,7 +4,7 @@
<package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="win81" /> <package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" /> <package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" /> <package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.37.5000" targetFramework="win81" /> <package id="ModernKeePassLib" version="2.37.6000" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" /> <package id="NETStandard.Library" version="2.0.1" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" /> <package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" /> <package id="Splat" version="2.0.0" targetFramework="win81" />

View File

@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>ModernKeePassLib</id> <id>ModernKeePassLib</id>
<version>2.37.5000</version> <version>2.37.6000</version>
<title>ModernKeePassLib</title> <title>ModernKeePassLib</title>
<authors>Geoffroy Bonneville</authors> <authors>Geoffroy Bonneville</authors>
<owners>Geoffroy Bonneville</owners> <owners>Geoffroy Bonneville</owners>
@@ -10,7 +10,7 @@
<projectUrl>https://github.com/wismna/ModernKeePass</projectUrl> <projectUrl>https://github.com/wismna/ModernKeePass</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Portable KeePass Password Management Library that targets .Net Standard and WinRT. Allows reading, editing and writing to KeePass 2.x databases.</description> <description>Portable KeePass Password Management Library that targets .Net Standard and WinRT. Allows reading, editing and writing to KeePass 2.x databases.</description>
<releaseNotes>KDBX 4 file format supported</releaseNotes> <releaseNotes>TBD</releaseNotes>
<copyright>Copyright © 2017 Geoffroy Bonneville</copyright> <copyright>Copyright © 2017 Geoffroy Bonneville</copyright>
<tags>KeePass KeePassLib Portable PCL NetStandard</tags> <tags>KeePass KeePassLib Portable PCL NetStandard</tags>
<dependencies> <dependencies>

View File

@@ -0,0 +1,13 @@
# ModernKeePassLib
This is my adaptation of the KeePassLib (KeePass library) for the Universal Windows Platform and Windows Runtime (WinRT).
It aims at introducing as little change as possible to the original library: overall, except for namespace changes and some added classes (see below), there is almost no change.
Download the Nuget package [here](https://www.nuget.org/packages/ModernKeePassLib)
# Features
- Custom implementation of the System.Security.Cryptography.HashAlgoritm class by using WinRT equivalents
- Use of BouncyCastle PCL to implement AES key derivation features
- Lots of small changes in .NET methods (UTF8 instead of ASCII, string.)
- Disabled native functions (because not compatible with WinRT)
- Use of Splat for GfxUtil

View File

@@ -26,11 +26,8 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
#if ModernKeePassLib
using Windows.Security.Cryptography; #if !ModernKeePassLib && !KeePassUAP
using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams;
#else
using System.Security.Cryptography; using System.Security.Cryptography;
#endif #endif
@@ -40,15 +37,15 @@ using System.IO.Compression;
using KeePassLibSD; using KeePassLibSD;
#endif #endif
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLib.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLib.Utility;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Security; using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
namespace ModernKeePassLib.Serialization namespace ModernKeePassLib.Serialization
{ {

View File

@@ -25,9 +25,8 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
#if ModernKeePassLib
using Windows.Security.Cryptography; #if !ModernKeePassLib && !KeePassUAP
#else
using System.Drawing; using System.Drawing;
using System.Security.Cryptography; using System.Security.Cryptography;
#endif #endif
@@ -41,15 +40,13 @@ using System.IO.Compression;
using ModernKeePassLib.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLib.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLib.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLib.Security; using ModernKeePassLib.Security;
using ModernKeePassLib.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams;
using ModernKeePassLib.Cryptography.KeyDerivation;
namespace ModernKeePassLib.Serialization namespace ModernKeePassLib.Serialization
{ {
@@ -212,8 +209,13 @@ namespace ModernKeePassLib.Serialization
xws.Indent = true; xws.Indent = true;
xws.IndentChars = "\t"; xws.IndentChars = "\t";
xws.NewLineOnAttributes = false; xws.NewLineOnAttributes = false;
#if ModernKeePassLib
// This is needed for Argon2Kdf write
xws.Async = true;
if (m_uFileVersion >= FileVersion32_4) xws.CloseOutput = true;
#endif
XmlWriter xw = XmlWriter.Create(sXml, xws); XmlWriter xw = XmlWriter.Create(sXml, xws);
#else #else
XmlTextWriter xw = new XmlTextWriter(sXml, encNoBom); XmlTextWriter xw = new XmlTextWriter(sXml, encNoBom);

View File

@@ -519,8 +519,8 @@ namespace ModernKeePassLib.Serialization
byte[] pbData = pb.ReadData(); byte[] pbData = pb.ReadData();
/*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result; /*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result;
using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/ using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/
var file = StorageFile.GetFileFromPathAsync(strPath).GetResults(); var file = StorageFile.GetFileFromPathAsync(strPath).GetAwaiter().GetResult();
using (var stream = file.OpenAsync(FileAccessMode.ReadWrite).GetResults().AsStream()) using (var stream = file.OpenAsync(FileAccessMode.ReadWrite).GetAwaiter().GetResult().AsStream())
{ {
stream.Write (pbData, 0, pbData.Length); stream.Write (pbData, 0, pbData.Length);
} }

View File

@@ -1,20 +1,40 @@
# Introduction # Introduction
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project. **ModernKeePass** is port of the classic Windows application KeePass 2.x for the Windows Store.
It does not aim to be feature perfect, but aims at being simple to use and user-friendly.
# Getting Started You can get it [here](https://www.microsoft.com/fr-fr/store/p/modernkeepass/9mwq48zk8nhv?rtc=1)
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
1. Installation process # Features
2. Software dependencies - Works on Windows 10, 8.1 and RT
3. Latest releases - Read and write support of KDBX files version 2, 3 and 4
4. API references - Open database with password and key file
- Create new databases
- Create, edit and delete groups
- Create, edit and delete entries
- Generate passwords for entries
- Use Recycle Bin
- Search entries
- Use Semantic Zoom to see your entries in a grouped mode
- List recently opened databases
- Open database from Windows Explorer
- Change database encryption
- Change database compression
- Change database key derivation
- Displays entry colors and icons (set in KeePass)
# Build and Test # Build and Test
TODO: Describe and show how to build your code and run the tests. 1. Clone the repository
2. Build the main app (the library reference dll is actually a NuGet dependency, built from the [**ModernKeePassLib** project](../ModernKeePassLib/README.md))
# Contribute # Contribute
TODO: Explain how other users and developers can contribute to make your code better. I'm not the best at creating nice assets, so if anyone would like to contribute some nice icons, it would be awesome :)
Otherwise, there are still many things left to implement:
- Entry custom fields
- Multi entry selection (for delete, or move)
- Move entries from a group to another
- Create key files
- Open database from URL (and maybe some clouds?)
If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files: # Credits
- [ASP.NET Core](https://github.com/aspnet/Home) *Dominik Reichl* for the [KeePass application](https://keepass.info/), library and file format
- [Visual Studio Code](https://github.com/Microsoft/vscode) *David Lechner* for his [PCL adapatation](https://github.com/dlech/KeePass2PCL) of the KeePass Library and the correlated tests which served as an inspiration basis for my own adaptation
- [Chakra Core](https://github.com/Microsoft/ChakraCore)