19 Commits
V1.8 ... V1.9

Author SHA1 Message Date
BONNEVILLE Geoffroy
e9c79b192b Finally satisfiable assets
Attempt to handle null reference exception in Key File (not sure to have found source)
2017-11-20 17:21:22 +01:00
BONNEVILLE Geoffroy
52c56757ca Correctly reference logo assets 2017-11-17 17:48:24 +01:00
BONNEVILLE Geoffroy
559af0ddd8 Clean up 2017-11-17 17:43:56 +01:00
BONNEVILLE Geoffroy
cd1b3ce1ed Changed app assets (not fully satisfied though) 2017-11-17 17:43:01 +01:00
BONNEVILLE Geoffroy
5273a25385 Adds the ability to create key files (no entropy generator for now) 2017-11-17 10:20:54 +01:00
BONNEVILLE Geoffroy
3089609c19 Code cleanup 2017-11-16 18:55:20 +01:00
BONNEVILLE Geoffroy
e1f62342d9 Update app and tests to use new ModernKeePassLib 2017-11-15 18:17:41 +01:00
BONNEVILLE Geoffroy
9313ac1abf Repaired key file creation in lib 2017-11-15 17:56:31 +01:00
7a632c8f80 Updated README.md 2017-11-15 09:35:57 +00:00
7f9a0e5b1e Updated README.md 2017-11-14 17:30:37 +00:00
BONNEVILLE Geoffroy
b0a3f796cb Merge branch 'master' of https://geogeob.visualstudio.com/_git/ModernKeePass 2017-11-14 18:00:47 +01:00
BONNEVILLE Geoffroy
97521f174a Test project uses same certificate as main App 2017-11-14 18:00:44 +01:00
432d5e49d5 Updated ImportCertificate.ps1 2017-11-14 16:26:44 +00:00
b2c8f2e0f4 Updated ImportCertificate.ps1 2017-11-14 16:22:37 +00:00
23011568b7 Updated ImportCertificate.ps1 2017-11-14 16:15:31 +00:00
078f9535cf Updated ImportCertificate.ps1 2017-11-14 16:10:28 +00:00
BONNEVILLE Geoffroy
ea481187d5 Add build scripts 2017-11-14 17:03:24 +01:00
BONNEVILLE Geoffroy
810caaf8e2 Test project uses Nuget for lib 2017-11-13 18:31:47 +01:00
BONNEVILLE Geoffroy
d290d9b4e3 Exclude certificate from project 2017-11-13 17:19:08 +01:00
71 changed files with 309 additions and 129 deletions

View File

@@ -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

View File

@@ -13,5 +13,4 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -48,6 +48,7 @@
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="{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>

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Windows.Storage.Pickers;
using Windows.System;
using Windows.UI.Xaml;
@@ -81,5 +82,20 @@ namespace ModernKeePass.Controls
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);
}
}
}

View 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" />

View File

@@ -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.8.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">

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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
[assembly: ComVisible(false)]

View File

@@ -117,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;
@@ -127,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;
}
}

View 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" />

View File

@@ -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));
}
}
}

View File

@@ -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();

View File

@@ -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">

View File

@@ -1,56 +1,32 @@
<?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>
<Capability Name="internetClient" />
</Capabilities>
</Package>
</Package>

View File

@@ -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>

View File

@@ -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

View File

@@ -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;

View File

@@ -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>

View File

@@ -1,3 +1,5 @@
[<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)
# 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.
@@ -25,6 +27,7 @@ You can get it [here](https://www.microsoft.com/fr-fr/store/p/modernkeepass/9mwq
# Build and Test
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
I'm not the best at creating nice assets, so if anyone would like to contribute some nice icons, it would be awesome :)

View 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
View 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
View 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")