Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e9c79b192b | ||
![]() |
52c56757ca | ||
![]() |
559af0ddd8 | ||
![]() |
cd1b3ce1ed | ||
![]() |
5273a25385 | ||
![]() |
3089609c19 | ||
![]() |
e1f62342d9 | ||
![]() |
9313ac1abf | ||
7a632c8f80 | |||
7f9a0e5b1e | |||
![]() |
b0a3f796cb | ||
![]() |
97521f174a | ||
432d5e49d5 | |||
b2c8f2e0f4 | |||
23011568b7 | |||
078f9535cf | |||
![]() |
ea481187d5 | ||
![]() |
810caaf8e2 | ||
![]() |
d290d9b4e3 | ||
![]() |
abb12accc7 | ||
2779e5b7c7 | |||
3970d485f6 | |||
![]() |
7b888cc4a2 | ||
![]() |
117513d6bf | ||
97511ab290 | |||
3131eca8a1 | |||
91a5507217 | |||
7d904b7120 | |||
![]() |
be72fc4f7e |
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLib", "ModernK
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLib.Test", "ModernKeePassLib.Test\ModernKeePassLib.Test.csproj", "{0A4279CF-2A67-4868-9906-052E50C25F3B}"
|
||||
EndProject
|
||||
Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Scripts", "Scripts\Scripts.pssproj", "{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -85,6 +87,22 @@ Global
|
||||
{0A4279CF-2A67-4868-9906-052E50C25F3B}.Release|x86.ActiveCfg = Release|x86
|
||||
{0A4279CF-2A67-4868-9906-052E50C25F3B}.Release|x86.Build.0 = Release|x86
|
||||
{0A4279CF-2A67-4868-9906-052E50C25F3B}.Release|x86.Deploy.0 = Release|x86
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|x64.Build.0 = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -13,5 +13,4 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
</Application>
|
||||
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1020 B After Width: | Height: | Size: 607 B |
BIN
ModernKeePass/Assets/ModernKeePass-SmallLogo.targetsize-16.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
ModernKeePass/Assets/ModernKeePass-SmallLogo.targetsize-256.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
ModernKeePass/Assets/ModernKeePass-SmallLogo.targetsize-32.png
Normal file
After Width: | Height: | Size: 736 B |
BIN
ModernKeePass/Assets/ModernKeePass-SmallLogo.targetsize-48.png
Normal file
After Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1020 B After Width: | Height: | Size: 607 B |
BIN
ModernKeePass/Assets/SmallLogo.targetsize-16.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
ModernKeePass/Assets/SmallLogo.targetsize-256.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
ModernKeePass/Assets/SmallLogo.targetsize-32.png
Normal file
After Width: | Height: | Size: 736 B |
BIN
ModernKeePass/Assets/SmallLogo.targetsize-48.png
Normal file
After Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 961 B |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.0 KiB |
@@ -14,6 +14,9 @@ namespace ModernKeePass.Common
|
||||
{
|
||||
public enum DatabaseStatus
|
||||
{
|
||||
Error = -3,
|
||||
NoCompositeKey = -2,
|
||||
CompositeKeyError = -1,
|
||||
Closed = 0,
|
||||
Opening = 1,
|
||||
Opened = 2
|
||||
@@ -77,11 +80,11 @@ namespace ModernKeePass.Common
|
||||
/// <param name="key">The database composite key</param>
|
||||
/// <param name="createNew">True to create a new database before opening it</param>
|
||||
/// <returns>An error message, if any</returns>
|
||||
public string Open(CompositeKey key, bool createNew = false)
|
||||
public void Open(CompositeKey key, bool createNew = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (key == null) return "No composite key";
|
||||
if (key == null) Status = DatabaseStatus.NoCompositeKey;
|
||||
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
|
||||
if (createNew) _pwDatabase.New(ioConnection, key);
|
||||
else _pwDatabase.Open(ioConnection, key, new NullStatusLogger());
|
||||
@@ -92,19 +95,14 @@ namespace ModernKeePass.Common
|
||||
RootGroup = new GroupVm(_pwDatabase.RootGroup, null, RecycleBinEnabled ? _pwDatabase.RecycleBinUuid : null);
|
||||
}
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
return "Password cannot be empty";
|
||||
}
|
||||
catch (InvalidCompositeKeyException)
|
||||
{
|
||||
return "Wrong password";
|
||||
Status = DatabaseStatus.CompositeKeyError;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
Status = DatabaseStatus.Error;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -121,11 +119,19 @@ namespace ModernKeePass.Common
|
||||
/// <summary>
|
||||
/// Commit the changes to the currently opened database to file
|
||||
/// </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 /*|| KdfPool.Get(KeyDerivation.KdfUuid) is Argon2Kdf*/) return;
|
||||
_pwDatabase.Save(new NullStatusLogger());
|
||||
if (_pwDatabase == null || !_pwDatabase.IsOpen) return false;
|
||||
try
|
||||
{
|
||||
_pwDatabase.Save(new NullStatusLogger());
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageDialogHelper.ShowErrorDialog(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -23,5 +23,17 @@ namespace ModernKeePass.Common
|
||||
// Show the message dialog
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,7 +47,8 @@
|
||||
Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushConverter}}"
|
||||
Visibility="{Binding ShowComplexityIndicator, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<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.Row="1" Grid.Column="1" HorizontalAlignment="Right" Content="Create new key" Visibility="{Binding ShowComplexityIndicator, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" IsEnabled="{Binding HasKeyFile}" Click="CreateKeyFileButton_Click" />
|
||||
<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}}" />
|
||||
</Grid>
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Events;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace ModernKeePass.Controls
|
||||
ValidationChecking?.Invoke(this, new EventArgs());
|
||||
|
||||
if (UpdateKey) Model.UpdateKey();
|
||||
else if (Model.OpenDatabase(CreateNew) == DatabaseHelper.DatabaseStatus.Opened)
|
||||
else if (Model.OpenDatabase(CreateNew))
|
||||
{
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
|
||||
}
|
||||
@@ -78,7 +78,24 @@ namespace ModernKeePass.Controls
|
||||
picker.FileTypeFilter.Add(".key");
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
private async void CreateKeyFileButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var savePicker = new FileSavePicker
|
||||
{
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
|
||||
SuggestedFileName = "Key"
|
||||
};
|
||||
savePicker.FileTypeChoices.Add("Key file", new List<string> { ".key" });
|
||||
|
||||
var file = await savePicker.PickSaveFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
Model.CreateKeyFile(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -200,8 +200,6 @@
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="ModernKeePass_StoreKey.pfx" />
|
||||
<None Include="ModernKeePass_TemporaryKey.pfx" />
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@@ -297,7 +295,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ModernKeePassLib.2.37.6000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
|
||||
<HintPath>..\packages\ModernKeePassLib.2.37.7000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -318,32 +316,23 @@
|
||||
<Name>BehaviorsXamlSDKManaged</Name>
|
||||
</SDKReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\Logo.scale-100.png" />
|
||||
<Content Include="Assets\Logo.scale-140.png" />
|
||||
<Content Include="Assets\Logo.scale-180.png" />
|
||||
<Content Include="Assets\Logo.scale-80.png" />
|
||||
<Content Include="Assets\ModernKeePass-Logo.scale-100.png" />
|
||||
<Content Include="Assets\ModernKeePass-Logo.scale-140.png" />
|
||||
<Content Include="Assets\ModernKeePass-Logo.scale-180.png" />
|
||||
<Content Include="Assets\ModernKeePass-Logo.scale-80.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.scale-100.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.scale-140.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.scale-180.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.scale-80.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.targetsize-16.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.targetsize-256.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.targetsize-32.png" />
|
||||
<Content Include="Assets\ModernKeePass-SmallLogo.targetsize-48.png" />
|
||||
<Content Include="Assets\ModernKeePass-SplashScreen.scale-100.png" />
|
||||
<Content Include="Assets\ModernKeePass-SplashScreen.scale-140.png" />
|
||||
<Content Include="Assets\ModernKeePass-SplashScreen.scale-180.png" />
|
||||
<Content Include="Assets\ModernKeePass-StoreLogo.scale-100.png" />
|
||||
<Content Include="Assets\ModernKeePass-StoreLogo.scale-140.png" />
|
||||
<Content Include="Assets\ModernKeePass-StoreLogo.scale-180.png" />
|
||||
<Content Include="Assets\SmallLogo.scale-100.png" />
|
||||
<Content Include="Assets\SmallLogo.scale-140.png" />
|
||||
<Content Include="Assets\SmallLogo.scale-180.png" />
|
||||
<Content Include="Assets\SmallLogo.scale-80.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-100.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-140.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-180.png" />
|
||||
<Content Include="Assets\Square310x310Logo.scale-100.png" />
|
||||
<Content Include="Assets\Square310x310Logo.scale-140.png" />
|
||||
<Content Include="Assets\Square310x310Logo.scale-180.png" />
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<?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">
|
||||
<Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.7.0.28" />
|
||||
<Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.9.0.30" />
|
||||
<Properties>
|
||||
<DisplayName>ModernKeePass</DisplayName>
|
||||
<PublisherDisplayName>wismna</PublisherDisplayName>
|
||||
<Logo>Assets\ModernKeePass-StoreLogo.png</Logo>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Prerequisites>
|
||||
<OSMinVersion>6.3.0</OSMinVersion>
|
||||
@@ -15,10 +15,10 @@
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="ModernKeePass.App">
|
||||
<m2:VisualElements DisplayName="ModernKeePass" Square150x150Logo="Assets\ModernKeePass-Logo.png" Square30x30Logo="Assets\ModernKeePass-SmallLogo.png" Description="A port of the KeePass application for the Windows store. You can create, open and edit KeePass 2.x password databases in a modern fashion." ForegroundText="light" BackgroundColor="#464646" ToastCapable="true">
|
||||
<m2:VisualElements DisplayName="ModernKeePass" Square150x150Logo="Assets\Logo.png" Square30x30Logo="Assets\ModernKeePass-SmallLogo.png" Description="A port of the KeePass application for the Windows store. You can create, open and edit KeePass 2.x password databases in a modern fashion." ForegroundText="light" BackgroundColor="#7755c4" ToastCapable="true">
|
||||
<m2:DefaultTile Square310x310Logo="Assets\Square310x310Logo.png" Wide310x150Logo="Assets\Wide310x150Logo.png" Square70x70Logo="Assets\Square70x70Logo.png">
|
||||
</m2:DefaultTile>
|
||||
<m2:SplashScreen Image="Assets\ModernKeePass-SplashScreen.png" />
|
||||
<m2:SplashScreen Image="Assets\ModernKeePass-SplashScreen.png" BackgroundColor="#7755c4" />
|
||||
</m2:VisualElements>
|
||||
<Extensions>
|
||||
<Extension Category="windows.fileOpenPicker">
|
||||
|
@@ -32,7 +32,7 @@
|
||||
<Run Text="Dominik Reichl for the KeePass application and file format"/>
|
||||
</TextBlock>
|
||||
<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>
|
||||
</StackPanel>
|
||||
</Page>
|
||||
|
@@ -24,6 +24,6 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.7.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.0.0")]
|
||||
[assembly: AssemblyVersion("1.9.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.9.0.0")]
|
||||
[assembly: ComVisible(false)]
|
@@ -1,4 +1,5 @@
|
||||
using Windows.Storage;
|
||||
using System.Text;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePassLib.Cryptography;
|
||||
@@ -24,6 +25,7 @@ namespace ModernKeePass.ViewModels
|
||||
private string _status;
|
||||
private StatusTypes _statusType;
|
||||
private StorageFile _keyFile;
|
||||
private string _keyFileText = "Select key file from disk...";
|
||||
|
||||
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
|
||||
{
|
||||
@@ -76,18 +78,37 @@ namespace ModernKeePass.ViewModels
|
||||
set
|
||||
{
|
||||
_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 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);
|
||||
RootGroup = _app.Database.RootGroup;
|
||||
return _app.Database.Status;
|
||||
_app.Database.Open(CreateCompositeKey(), createNew);
|
||||
switch (_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()
|
||||
@@ -96,6 +117,13 @@ namespace ModernKeePass.ViewModels
|
||||
UpdateStatus("Database composite key updated.", StatusTypes.Success);
|
||||
}
|
||||
|
||||
public void CreateKeyFile(StorageFile file)
|
||||
{
|
||||
// TODO: implement entropy generator
|
||||
KcpKeyFile.Create(file, null);
|
||||
KeyFile = file;
|
||||
}
|
||||
|
||||
private void UpdateStatus(string text, StatusTypes type)
|
||||
{
|
||||
Status = text;
|
||||
@@ -106,7 +134,7 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
var compositeKey = new CompositeKey();
|
||||
if (HasPassword) compositeKey.AddUserKey(new KcpPassword(Password));
|
||||
if (HasKeyFile) compositeKey.AddUserKey(new KcpKeyFile(IOConnectionInfo.FromFile(KeyFile)));
|
||||
if (HasKeyFile && KeyFile != null) compositeKey.AddUserKey(new KcpKeyFile(IOConnectionInfo.FromFile(KeyFile)));
|
||||
return compositeKey;
|
||||
}
|
||||
}
|
||||
|
@@ -91,7 +91,7 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public SettingsDatabaseVm()
|
||||
{
|
||||
Groups = _app.Database.RootGroup.Groups;
|
||||
Groups = _app?.Database.RootGroup.Groups;
|
||||
}
|
||||
|
||||
// TODO: Move to another setting class (or a static class)
|
||||
|
@@ -8,9 +8,7 @@ namespace ModernKeePass.ViewModels
|
||||
public void Save(bool close = true)
|
||||
{
|
||||
var app = (App)Application.Current;
|
||||
app.Database.Save();
|
||||
if (!close) return;
|
||||
app.Database.Close();
|
||||
if (close && app.Database.Save()) app.Database.Close();
|
||||
}
|
||||
|
||||
internal void Save(StorageFile file)
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="win81" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="win81" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="2.0.1" 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="ModernKeePassLib" version="2.37.6000" targetFramework="win81" />
|
||||
<package id="ModernKeePassLib" version="2.37.7000" 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="Splat" version="2.0.0" targetFramework="win81" />
|
||||
|
@@ -13,64 +13,62 @@ namespace ModernKeePassLib.Test.Cryptography.Cipher
|
||||
public class StandardAesEngineTests
|
||||
{
|
||||
// Test vector (official ECB test vector #356)
|
||||
private byte[] pbReferenceCT = new byte[16] {
|
||||
0x75, 0xD1, 0x1B, 0x0E, 0x3A, 0x68, 0xC4, 0x22,
|
||||
0x3D, 0x88, 0xDB, 0xF0, 0x17, 0x97, 0x7D, 0xD7
|
||||
};
|
||||
private readonly byte[] _pbReferenceCt =
|
||||
{
|
||||
0x75, 0xD1, 0x1B, 0x0E, 0x3A, 0x68, 0xC4, 0x22,
|
||||
0x3D, 0x88, 0xDB, 0xF0, 0x17, 0x97, 0x7D, 0xD7
|
||||
};
|
||||
private readonly byte[] _pbIv = new byte[16];
|
||||
private readonly byte[] _pbTestKey = new byte[32];
|
||||
private readonly byte[] _pbTestData =
|
||||
{
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
[TestMethod]
|
||||
public void TestEncryptStream()
|
||||
{
|
||||
byte[] pbIV = new byte[16];
|
||||
byte[] pbTestKey = new byte[32];
|
||||
byte[] pbTestData = new byte[16];
|
||||
pbTestData[0] = 0x04;
|
||||
|
||||
var outStream = new MemoryStream(new byte[16]);
|
||||
var aes = new StandardAesEngine();
|
||||
var inStream = aes.EncryptStream(outStream, pbTestKey, pbIV);
|
||||
new BinaryWriter(inStream).Write(pbTestData);
|
||||
Assert.AreEqual(outStream.Position, 16);
|
||||
outStream.Position = 0;
|
||||
var outBytes = new BinaryReaderEx(outStream, Encoding.UTF8, string.Empty).ReadBytes(16);
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(outBytes, pbReferenceCT));
|
||||
using (var outStream = new MemoryStream(new byte[16]))
|
||||
{
|
||||
var aes = new StandardAesEngine();
|
||||
using (var inStream = aes.EncryptStream(outStream, _pbTestKey, _pbIv))
|
||||
{
|
||||
new BinaryWriter(inStream).Write(_pbTestData);
|
||||
Assert.AreEqual(16, outStream.Position);
|
||||
outStream.Position = 0;
|
||||
var outBytes = new BinaryReaderEx(outStream, Encoding.UTF8, string.Empty).ReadBytes(16);
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(outBytes, _pbReferenceCt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDecryptStream()
|
||||
{
|
||||
byte[] pbIV = new byte[16];
|
||||
byte[] pbTestKey = new byte[32];
|
||||
byte[] pbTestData = new byte[16];
|
||||
pbTestData[0] = 0x04;
|
||||
|
||||
{
|
||||
// Possible Mono Bug? This only works with size >= 48
|
||||
var inStream = new MemoryStream(new byte[32]);
|
||||
inStream.Write(pbReferenceCT, 0, pbReferenceCT.Length);
|
||||
inStream.Position = 0;
|
||||
var aes = new StandardAesEngine();
|
||||
var outStream = aes.DecryptStream(inStream, pbTestKey, pbIV);
|
||||
var outBytes = new BinaryReaderEx(outStream, Encoding.UTF8, string.Empty).ReadBytes(16);
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(outBytes, pbTestData));
|
||||
using (var inStream = new MemoryStream(new byte[32]))
|
||||
{
|
||||
inStream.Write(_pbReferenceCt, 0, _pbReferenceCt.Length);
|
||||
inStream.Position = 0;
|
||||
var aes = new StandardAesEngine();
|
||||
using (var outStream = aes.DecryptStream(inStream, _pbTestKey, _pbIv))
|
||||
{
|
||||
var outBytes = new BinaryReaderEx(outStream, Encoding.UTF8, string.Empty).ReadBytes(16);
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(outBytes, _pbTestData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestBouncyCastleAes()
|
||||
{
|
||||
byte[] pbIV = new byte[16];
|
||||
byte[] pbTestKey = new byte[32];
|
||||
byte[] pbTestData = new byte[16];
|
||||
/*int i;
|
||||
for (i = 0; i < 16; ++i) pbIV[i] = 0;
|
||||
for (i = 0; i < 32; ++i) pbTestKey[i] = 0;
|
||||
for (i = 0; i < 16; ++i) pbTestData[i] = 0;*/
|
||||
pbTestData[0] = 0x04;
|
||||
|
||||
var aesEngine = new AesEngine();
|
||||
//var parametersWithIv = new ParametersWithIV(new KeyParameter(pbTestKey), pbIV);
|
||||
aesEngine.Init(true, new KeyParameter(pbTestKey));
|
||||
Assert.AreEqual(aesEngine.GetBlockSize(), pbTestData.Length);
|
||||
aesEngine.ProcessBlock(pbTestData, 0, pbTestData, 0);
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(pbTestData, pbReferenceCT));
|
||||
aesEngine.Init(true, new KeyParameter(_pbTestKey));
|
||||
Assert.AreEqual(aesEngine.GetBlockSize(), _pbTestData.Length);
|
||||
aesEngine.ProcessBlock(_pbTestData, 0, _pbTestData, 0);
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(_pbTestData, _pbReferenceCt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ namespace ModernKeePassLib.Test.Keys
|
||||
0x31, 0xAA, 0x14, 0x3D, 0x95, 0xBF, 0x63, 0xFF
|
||||
};
|
||||
|
||||
var fullPath = Path.Combine(ApplicationData.Current.TemporaryFolder.Path, TestCreateFile);
|
||||
//var fullPath = Path.Combine(ApplicationData.Current.TemporaryFolder.Path, TestCreateFile);
|
||||
var file = ApplicationData.Current.TemporaryFolder.CreateFileAsync(TestCreateFile).GetAwaiter().GetResult();
|
||||
using (var fs = file.OpenStreamForWriteAsync().GetAwaiter().GetResult())
|
||||
{
|
||||
@@ -50,7 +50,7 @@ namespace ModernKeePassLib.Test.Keys
|
||||
|
||||
try
|
||||
{
|
||||
var keyFile = new KcpKeyFile(fullPath);
|
||||
var keyFile = new KcpKeyFile(file);
|
||||
var keyData = keyFile.KeyData.ReadData();
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(keyData, expectedKeyData));
|
||||
}
|
||||
@@ -63,9 +63,9 @@ namespace ModernKeePassLib.Test.Keys
|
||||
[TestMethod]
|
||||
public void TestCreate()
|
||||
{
|
||||
var fullPath = Path.Combine(ApplicationData.Current.TemporaryFolder.Path, TestCreateFile);
|
||||
//var fullPath = Path.Combine(ApplicationData.Current.TemporaryFolder.Path, TestCreateFile);
|
||||
var file = ApplicationData.Current.TemporaryFolder.CreateFileAsync(TestCreateFile).GetAwaiter().GetResult();
|
||||
KcpKeyFile.Create(fullPath, null);
|
||||
KcpKeyFile.Create(file, null);
|
||||
try
|
||||
{
|
||||
var fileContents = FileIO.ReadTextAsync(file).GetAwaiter().GetResult();
|
||||
|
@@ -16,9 +16,14 @@
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>ModernKeePassLib.Test_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<PackageCertificateKeyFile>
|
||||
</PackageCertificateKeyFile>
|
||||
<AppxBundle>Never</AppxBundle>
|
||||
<AllowCrossPlatformRetargeting>False</AllowCrossPlatformRetargeting>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PackageCertificateThumbprint>ED3AA34F46D03498F989901C5DB2742B65D72F60</PackageCertificateThumbprint>
|
||||
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -140,20 +145,17 @@
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="ModernKeePassLib.Test_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ModernKeePassLib\ModernKeePassLib.csproj">
|
||||
<Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project>
|
||||
<Name>ModernKeePassLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ModernKeePassLib.2.37.7000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -185,6 +187,13 @@
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<Import Project="..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
@@ -1,53 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
|
||||
|
||||
<Identity Name="2aac30f7-3bad-4e17-be76-27de378756c9"
|
||||
Publisher="CN=GBE"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
|
||||
<Identity Name="2aac30f7-3bad-4e17-be76-27de378756c9" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.0.0.0" />
|
||||
<Properties>
|
||||
<DisplayName>ModernKeePassLib.Test</DisplayName>
|
||||
<PublisherDisplayName>GBE</PublisherDisplayName>
|
||||
<PublisherDisplayName>wismna</PublisherDisplayName>
|
||||
<Logo>Images\UnitTestStoreLogo.png</Logo>
|
||||
<Description>ModernKeePassLib.Test</Description>
|
||||
</Properties>
|
||||
|
||||
<Prerequisites>
|
||||
<OSMinVersion>6.3.0</OSMinVersion>
|
||||
<OSMaxVersionTested>6.3.0</OSMaxVersionTested>
|
||||
</Prerequisites>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="vstest.executionengine.App"
|
||||
Executable="vstest.executionengine.appcontainer.exe"
|
||||
EntryPoint="vstest.executionengine.App">
|
||||
<VisualElements
|
||||
DisplayName="NoUIEntryPoints"
|
||||
Logo="Images\UnitTestLogo.png"
|
||||
SmallLogo="Images\UnitTestSmallLogo.png"
|
||||
Description="vstest.executionengine.App"
|
||||
ForegroundText="light"
|
||||
BackgroundColor="#0084FF">
|
||||
<SplashScreen Image="Images\UnitTestSplashScreen.png" />
|
||||
</VisualElements>
|
||||
<Application Id="vstest.executionengine.App" Executable="vstest.executionengine.appcontainer.exe" EntryPoint="vstest.executionengine.App">
|
||||
<m2:VisualElements DisplayName="NoUIEntryPoints" Description="vstest.executionengine.App" BackgroundColor="#0084FF" ForegroundText="light" Square150x150Logo="Images\UnitTestLogo.png" Square30x30Logo="Images\UnitTestSmallLogo.png">
|
||||
<m2:SplashScreen Image="Images\UnitTestSplashScreen.png" />
|
||||
</m2:VisualElements>
|
||||
</Application>
|
||||
|
||||
<Application Id="vstest.executionengine.x86.App"
|
||||
Executable="vstest.executionengine.appcontainer.x86.exe"
|
||||
EntryPoint="vstest.executionengine.x86.App">
|
||||
<VisualElements
|
||||
DisplayName="NoUIEntryPoints"
|
||||
Logo="Images\UnitTestLogo.png"
|
||||
SmallLogo="Images\UnitTestSmallLogo.png"
|
||||
Description="vstest.executionengine.x86.App"
|
||||
ForegroundText="light"
|
||||
BackgroundColor="#0084FF">
|
||||
<SplashScreen Image="Images\UnitTestSplashScreen.png" />
|
||||
</VisualElements>
|
||||
<Application Id="vstest.executionengine.x86.App" Executable="vstest.executionengine.appcontainer.x86.exe" EntryPoint="vstest.executionengine.x86.App">
|
||||
<VisualElements DisplayName="NoUIEntryPoints" Logo="Images\UnitTestLogo.png" SmallLogo="Images\UnitTestSmallLogo.png" Description="vstest.executionengine.x86.App" ForegroundText="light" BackgroundColor="#0084FF">
|
||||
<SplashScreen Image="Images\UnitTestSplashScreen.png" />
|
||||
</VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="win81" />
|
||||
<package id="NETStandard.Library" version="1.6.1" targetFramework="win81" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="win81" />
|
||||
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
|
||||
<package id="ModernKeePassLib" version="2.37.7000" 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="Splat" version="2.0.0" targetFramework="win81" />
|
||||
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
|
||||
@@ -14,8 +16,9 @@
|
||||
<package id="System.IO.Compression" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Linq" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Net.Http" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Net.Http" version="4.3.3" targetFramework="win81" />
|
||||
<package id="System.Net.Primitives" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Net.Requests" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.ObjectModel" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Reflection" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="win81" />
|
||||
@@ -35,5 +38,6 @@
|
||||
<package id="System.Threading.Timer" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="win81" />
|
||||
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" />
|
||||
<package id="Validation" version="2.4.18" targetFramework="win81" />
|
||||
</packages>
|
@@ -118,7 +118,7 @@ namespace ModernKeePassLib.Cryptography
|
||||
for(i = 0; i < 16; ++i) pbTestData[i] = 0;
|
||||
pbTestData[0] = 0x04;
|
||||
|
||||
#if ModernKeePassLib
|
||||
#if ModernKeePassLib || KeePassUAP
|
||||
AesEngine r = new AesEngine();
|
||||
r.Init(true, new KeyParameter(pbTestKey));
|
||||
if(r.GetBlockSize() != pbTestData.Length)
|
||||
@@ -1032,7 +1032,7 @@ namespace ModernKeePassLib.Cryptography
|
||||
private static void TestUrlUtil()
|
||||
{
|
||||
#if DEBUG
|
||||
#if !ModernKeePassLib
|
||||
#if !ModernKeePassLib && !KeePassUAP
|
||||
Debug.Assert(Uri.UriSchemeHttp.Equals("http", StrUtil.CaseIgnoreCmp));
|
||||
Debug.Assert(Uri.UriSchemeHttps.Equals("https", StrUtil.CaseIgnoreCmp));
|
||||
#endif
|
||||
|
@@ -23,13 +23,13 @@ using System.IO;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
#if ModernKeePassLib
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Windows.Security.Cryptography;
|
||||
using Windows.Security.Cryptography.Core;
|
||||
using Windows.Storage;
|
||||
#else
|
||||
using System.Security.Cryptography;
|
||||
#endif
|
||||
@@ -68,6 +68,13 @@ namespace ModernKeePassLib.Keys
|
||||
get { return m_pbKeyData; }
|
||||
}
|
||||
|
||||
#if ModernKeePassLib
|
||||
public KcpKeyFile(StorageFile strKeyFile)
|
||||
{
|
||||
Construct(IOConnectionInfo.FromFile(strKeyFile), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
public KcpKeyFile(string strKeyFile)
|
||||
{
|
||||
Construct(IOConnectionInfo.FromPath(strKeyFile), false);
|
||||
@@ -185,7 +192,11 @@ namespace ModernKeePassLib.Keys
|
||||
/// the random key. May be <c>null</c> (in this case only the KeePass-internal
|
||||
/// random number generator is used).</param>
|
||||
/// <returns>Returns a <c>FileSaveResult</c> error code.</returns>
|
||||
#if ModernKeePassLib
|
||||
public static void Create(StorageFile strFilePath, byte[] pbAdditionalEntropy)
|
||||
#else
|
||||
public static void Create(string strFilePath, byte[] pbAdditionalEntropy)
|
||||
#endif
|
||||
{
|
||||
byte[] pbKey32 = CryptoRandom.Instance.GetRandomBytes(32);
|
||||
if(pbKey32 == null) throw new SecurityException();
|
||||
@@ -293,18 +304,25 @@ namespace ModernKeePassLib.Keys
|
||||
|
||||
return pbKeyData;
|
||||
}
|
||||
|
||||
#if ModernKeePassLib
|
||||
private static void CreateXmlKeyFile(StorageFile strFile, byte[] pbKeyData)
|
||||
#else
|
||||
private static void CreateXmlKeyFile(string strFile, byte[] pbKeyData)
|
||||
#endif
|
||||
{
|
||||
Debug.Assert(strFile != null);
|
||||
if(strFile == null) throw new ArgumentNullException("strFile");
|
||||
Debug.Assert(pbKeyData != null);
|
||||
if(pbKeyData == null) throw new ArgumentNullException("pbKeyData");
|
||||
|
||||
#if ModernKeePassLib
|
||||
IOConnectionInfo ioc = IOConnectionInfo.FromFile(strFile);
|
||||
#else
|
||||
IOConnectionInfo ioc = IOConnectionInfo.FromPath(strFile);
|
||||
#endif
|
||||
Stream sOut = IOConnection.OpenWrite(ioc);
|
||||
|
||||
#if ModernKeePassLib
|
||||
#if ModernKeePassLib || KeePassUAP
|
||||
XmlWriterSettings xws = new XmlWriterSettings();
|
||||
xws.Encoding = StrUtil.Utf8;
|
||||
xws.Indent = false;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>ModernKeePassLib</id>
|
||||
<version>2.37.6000</version>
|
||||
<version>2.37.7000</version>
|
||||
<title>ModernKeePassLib</title>
|
||||
<authors>Geoffroy Bonneville</authors>
|
||||
<owners>Geoffroy Bonneville</owners>
|
||||
@@ -10,7 +10,7 @@
|
||||
<projectUrl>https://github.com/wismna/ModernKeePass</projectUrl>
|
||||
<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>
|
||||
<releaseNotes>TBD</releaseNotes>
|
||||
<releaseNotes>Can now create key files</releaseNotes>
|
||||
<copyright>Copyright © 2017 Geoffroy Bonneville</copyright>
|
||||
<tags>KeePass KeePassLib Portable PCL NetStandard</tags>
|
||||
<dependencies>
|
||||
|
13
ModernKeePassLib/README.md
Normal 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
|
51
README.md
@@ -1,20 +1,43 @@
|
||||
# Introduction
|
||||
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
|
||||
[<img src="https://geogeob.visualstudio.com/_apis/public/build/definitions/04291454-0e79-47a4-9502-5bd374804ccf/2/badge"/>](https://geogeob.visualstudio.com/_apis/public/build/index?definitionId=2)
|
||||
|
||||
# Getting Started
|
||||
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
|
||||
1. Installation process
|
||||
2. Software dependencies
|
||||
3. Latest releases
|
||||
4. API references
|
||||
# Introduction
|
||||
**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.
|
||||
|
||||
You can get it [here](https://www.microsoft.com/fr-fr/store/p/modernkeepass/9mwq48zk8nhv?rtc=1)
|
||||
|
||||
# Features
|
||||
- Works on Windows 10, 8.1 and RT
|
||||
- Read and write support of KDBX files version 2, 3 and 4
|
||||
- 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
|
||||
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))
|
||||
3. Edit the `.appxmanifest` file to select another certificate (you can create one using Visual Studio or *certutil.exe*)
|
||||
|
||||
# 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:
|
||||
- [ASP.NET Core](https://github.com/aspnet/Home)
|
||||
- [Visual Studio Code](https://github.com/Microsoft/vscode)
|
||||
- [Chakra Core](https://github.com/Microsoft/ChakraCore)
|
||||
# Credits
|
||||
*Dominik Reichl* for the [KeePass application](https://keepass.info/), library and file format
|
||||
*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
|
||||
|
8
Scripts/ImportCertificate.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
# Enable -Verbose option
|
||||
[CmdletBinding()]
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$CertPath
|
||||
)
|
||||
Write-Host "Registering certificate: $CertPath"
|
||||
Import-Certificate -Filepath "$CertPath" -CertStoreLocation cert:\CurrentUser\Root
|
35
Scripts/Scripts.pssproj
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>6CAFC0C6-A428-4d30-A9F9-700E829FEA51</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>MyApplication</RootNamespace>
|
||||
<AssemblyName>MyApplication</AssemblyName>
|
||||
<Name>Scripts</Name>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ImportCertificate.ps1" />
|
||||
<Compile Include="UpdateVersion.ps1" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="Build" />
|
||||
</Project>
|
99
Scripts/UpdateVersion.ps1
Normal file
@@ -0,0 +1,99 @@
|
||||
#Based on https://www.visualstudio.com/docs/build/scripts/index
|
||||
# Enable -Verbose option
|
||||
[CmdletBinding()]
|
||||
|
||||
$VersionRegex = "\d+\.\d+\.\d+\.\d+"
|
||||
|
||||
$ManifestVersionRegex = " Version=""\d+\.\d+\.\d+\.\d+"""
|
||||
|
||||
if (-not $Env:BUILD_BUILDNUMBER)
|
||||
{
|
||||
Write-Error ("BUILD_BUILDNUMBER environment variable is missing.")
|
||||
exit 1
|
||||
}
|
||||
Write-Verbose "BUILD_BUILDNUMBER: $Env:BUILD_BUILDNUMBER"
|
||||
|
||||
$ScriptPath = $null
|
||||
try
|
||||
{
|
||||
$ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
|
||||
$ScriptDir = Split-Path -Parent $ScriptPath
|
||||
}
|
||||
catch {}
|
||||
|
||||
if (!$ScriptPath)
|
||||
{
|
||||
Write-Error "Current path not found!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Get and validate the version data
|
||||
$VersionData = [regex]::matches($Env:BUILD_BUILDNUMBER,$VersionRegex)
|
||||
switch($VersionData.Count)
|
||||
{
|
||||
0
|
||||
{
|
||||
Write-Error "Could not find version number data in BUILD_BUILDNUMBER."
|
||||
exit 1
|
||||
}
|
||||
1 {}
|
||||
default
|
||||
{
|
||||
Write-Warning "Found more than instance of version data in BUILD_BUILDNUMBER."
|
||||
Write-Warning "Will assume first instance is version."
|
||||
}
|
||||
}
|
||||
$NewVersion = $VersionData[0]
|
||||
Write-Verbose "Version: $NewVersion"
|
||||
|
||||
|
||||
$AssemblyVersion = $NewVersion
|
||||
$ManifestVersion = " Version=""$NewVersion"""
|
||||
|
||||
Write-Host "Version: $AssemblyVersion"
|
||||
Write-Host "Manifest: $ManifestVersion"
|
||||
Write-Host "ScriptDir: " $ScriptDir
|
||||
|
||||
# Apply the version to the assembly property files
|
||||
$assemblyInfoFiles = gci $ScriptDir -recurse -include "*Properties*","My Project" |
|
||||
?{ $_.PSIsContainer } |
|
||||
foreach { gci -Path $_.FullName -Recurse -include AssemblyInfo.* }
|
||||
|
||||
if($assemblyInfoFiles)
|
||||
{
|
||||
Write-Host "Will apply $AssemblyVersion to $($assemblyInfoFiles.count) Assembly Info Files."
|
||||
|
||||
foreach ($file in $assemblyInfoFiles) {
|
||||
$filecontent = Get-Content($file)
|
||||
attrib $file -r
|
||||
$filecontent -replace $VersionRegex, $AssemblyVersion | Out-File $file utf8
|
||||
|
||||
Write-Host "$file.FullName - version applied"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning "No Assembly Info Files found."
|
||||
}
|
||||
|
||||
# Try Manifests
|
||||
$manifestFiles = gci .\ -recurse -include "Package.appxmanifest"
|
||||
|
||||
if($manifestFiles)
|
||||
{
|
||||
Write-Host "Will apply $ManifestVersion to $($manifestFiles.count) Manifests."
|
||||
|
||||
foreach ($file in $manifestFiles) {
|
||||
$filecontent = Get-Content($file)
|
||||
attrib $file -r
|
||||
$filecontent -replace $ManifestVersionRegex, $ManifestVersion | Out-File $file utf8
|
||||
|
||||
Write-Host "$file.FullName - version applied to Manifest"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning "No Manifest files found."
|
||||
}
|
||||
|
||||
Write-Host ("##vso[task.setvariable variable=AppxVersion;]$NewVersion")
|