mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Write-mode is finally working!!!
Lib uses BouncyCastle crypto
This commit is contained in:
@@ -8,6 +8,9 @@ EndProject
|
|||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLibPCL", "ModernKeePassLib\ModernKeePassLibPCL.csproj", "{2E710089-9559-4967-846C-E763DD1F3ACB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLibPCL", "ModernKeePassLib\ModernKeePassLibPCL.csproj", "{2E710089-9559-4967-846C-E763DD1F3ACB}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLib.Test", "ModernKeePassLib.Test\ModernKeePassLib.Test.csproj", "{067456C0-086C-46A8-B37F-1405717B7BFC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLib.Test", "ModernKeePassLib.Test\ModernKeePassLib.Test.csproj", "{067456C0-086C-46A8-B37F-1405717B7BFC}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{2E710089-9559-4967-846C-E763DD1F3ACB} = {2E710089-9559-4967-846C-E763DD1F3ACB}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@@ -163,32 +163,8 @@
|
|||||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.1\lib\netstandard1.0\crypto.dll</HintPath>
|
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.1\lib\netstandard1.0\crypto.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ModernKeePassLibPCL, Version=2.28.1.31251, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ModernKeePassLibPCL, Version=2.28.1.25559, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ModernKeePassLibPCL.2.28.1.31251\lib\netstandard1.2\ModernKeePassLibPCL.dll</HintPath>
|
<HintPath>..\packages\ModernKeePassLibPCL.2.28.1.25559\lib\netstandard1.2\ModernKeePassLibPCL.dll</HintPath>
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PCLCrypto, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d4421c8a4786956c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PCLCrypto.2.0.147\lib\portable-win81+wpa81\PCLCrypto.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PCLStorage.1.0.2\lib\portable-win8+wpa81\PCLStorage.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PCLStorage.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PCLStorage.1.0.2\lib\portable-win8+wpa81\PCLStorage.Abstractions.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.BCrypt, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.BCrypt.0.5.97\lib\portable-net45+win8+wpa81\PInvoke.BCrypt.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.Kernel32, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.Kernel32.0.5.97\lib\portable-net45+win8+wpa81\PInvoke.Kernel32.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.NCrypt, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.NCrypt.0.5.97\lib\portable-net45+win8+wpa81\PInvoke.NCrypt.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PInvoke.Windows.Core, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
<Reference Include="PInvoke.Windows.Core, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
<TextBox x:Name="passwordTextBox" Grid.Row="3" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Password, Mode=TwoWay}" VerticalAlignment="Top" Width="250" FontSize="14,667" MaxLength="256" AllowDrop="True" Visibility="Collapsed"/>
|
<TextBox x:Name="passwordTextBox" Grid.Row="3" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Password, Mode=TwoWay}" VerticalAlignment="Top" Width="250" FontSize="14,667" MaxLength="256" AllowDrop="True" Visibility="Collapsed"/>
|
||||||
<CheckBox x:Name="checkBox" Grid.Row="4" Content="Show password" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Checked="checkBox_Checked" Unchecked="checkBox_Unchecked"/>
|
<CheckBox x:Name="checkBox" Grid.Row="4" Content="Show password" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Checked="checkBox_Checked" Unchecked="checkBox_Unchecked"/>
|
||||||
<TextBlock x:Name="urlTextBlock" Grid.Row="5" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="URL" VerticalAlignment="Top" FontSize="18"/>
|
<TextBlock x:Name="urlTextBlock" Grid.Row="5" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="URL" VerticalAlignment="Top" FontSize="18"/>
|
||||||
<TextBox x:Name="urlTextBox" Grid.Row="6" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding URL, Mode=TwoWay}" VerticalAlignment="Top" Width="250" FontSize="14,667" MaxLength="256" AllowDrop="True"/>
|
<TextBox x:Name="urlTextBox" Grid.Row="6" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Url, Mode=TwoWay}" VerticalAlignment="Top" Width="250" FontSize="14,667" MaxLength="256" AllowDrop="True"/>
|
||||||
<TextBlock x:Name="notesTextBlock" Grid.Row="7" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Notes" VerticalAlignment="Top" FontSize="18"/>
|
<TextBlock x:Name="notesTextBlock" Grid.Row="7" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Notes" VerticalAlignment="Top" FontSize="18"/>
|
||||||
<TextBox x:Name="notesTextBox" Grid.Row="8" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" VerticalAlignment="Top" Width="250" Height="32" IsSpellCheckEnabled="True" AllowDrop="True"/>
|
<TextBox x:Name="notesTextBox" Grid.Row="8" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" VerticalAlignment="Top" Width="250" Height="32" IsSpellCheckEnabled="True" AllowDrop="True"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@@ -1,17 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using ModernKeePass.Common;
|
using ModernKeePass.Common;
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Foundation.Collections;
|
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Controls.Primitives;
|
|
||||||
using Windows.UI.Xaml.Data;
|
|
||||||
using Windows.UI.Xaml.Input;
|
|
||||||
using Windows.UI.Xaml.Media;
|
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using ModernKeePass.ViewModels;
|
using ModernKeePass.ViewModels;
|
||||||
|
|
||||||
@@ -31,10 +21,7 @@ namespace ModernKeePass.Pages
|
|||||||
/// NavigationHelper est utilisé sur chaque page pour faciliter la navigation et
|
/// NavigationHelper est utilisé sur chaque page pour faciliter la navigation et
|
||||||
/// gestion de la durée de vie des processus
|
/// gestion de la durée de vie des processus
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NavigationHelper NavigationHelper
|
public NavigationHelper NavigationHelper => navigationHelper;
|
||||||
{
|
|
||||||
get { return this.navigationHelper; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntryDetailPage()
|
public EntryDetailPage()
|
||||||
{
|
{
|
||||||
@@ -51,16 +38,11 @@ namespace ModernKeePass.Pages
|
|||||||
/// Source de l'événement ; en général <see cref="Common.NavigationHelper"/>
|
/// Source de l'événement ; en général <see cref="Common.NavigationHelper"/>
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="e">Données d'événement qui fournissent le paramètre de navigation transmis à
|
/// <param name="e">Données d'événement qui fournissent le paramètre de navigation transmis à
|
||||||
/// <see cref="Frame.Navigate(Type, Object)"/> lors de la requête initiale de cette page et
|
/// <see cref="Frame.Navigate(Type, object)"/> lors de la requête initiale de cette page et
|
||||||
/// un dictionnaire d'état conservé par cette page durant une session
|
/// un dictionnaire d'état conservé par cette page durant une session
|
||||||
/// antérieure. L'état n'aura pas la valeur Null lors de la première visite de la page.</param>
|
/// antérieure. L'état n'aura pas la valeur Null lors de la première visite de la page.</param>
|
||||||
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
|
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
|
||||||
{
|
{
|
||||||
object navigationParameter;
|
|
||||||
if (e.PageState != null && e.PageState.ContainsKey("SelectedItem"))
|
|
||||||
{
|
|
||||||
navigationParameter = e.PageState["SelectedItem"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Inscription de NavigationHelper
|
#region Inscription de NavigationHelper
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using ModernKeePass.Common;
|
using System;
|
||||||
|
using ModernKeePass.Common;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using ModernKeePass.ViewModels;
|
using ModernKeePass.ViewModels;
|
||||||
@@ -19,10 +20,7 @@ namespace ModernKeePass.Pages
|
|||||||
/// NavigationHelper is used on each page to aid in navigation and
|
/// NavigationHelper is used on each page to aid in navigation and
|
||||||
/// process lifetime management
|
/// process lifetime management
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NavigationHelper NavigationHelper
|
public NavigationHelper NavigationHelper => navigationHelper;
|
||||||
{
|
|
||||||
get { return navigationHelper; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public GroupDetailPage()
|
public GroupDetailPage()
|
||||||
@@ -40,7 +38,7 @@ namespace ModernKeePass.Pages
|
|||||||
/// The source of the event; typically <see cref="Common.NavigationHelper"/>
|
/// The source of the event; typically <see cref="Common.NavigationHelper"/>
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="e">Event data that provides both the navigation parameter passed to
|
/// <param name="e">Event data that provides both the navigation parameter passed to
|
||||||
/// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
|
/// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
|
||||||
/// a dictionary of state preserved by this page during an earlier
|
/// a dictionary of state preserved by this page during an earlier
|
||||||
/// session. The state will be null the first time a page is visited.</param>
|
/// session. The state will be null the first time a page is visited.</param>
|
||||||
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
|
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
|
||||||
|
@@ -1,26 +1,55 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using ModernKeePassLibPCL;
|
using ModernKeePassLibPCL;
|
||||||
|
using ModernKeePassLibPCL.Security;
|
||||||
|
|
||||||
namespace ModernKeePass.ViewModels
|
namespace ModernKeePass.ViewModels
|
||||||
{
|
{
|
||||||
public class EntryVm : INotifyPropertyChanged
|
public class EntryVm : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
public string Title { get; set; }
|
public string Title
|
||||||
public string UserName { get; private set; }
|
{
|
||||||
public string Password { get; private set; }
|
get { return GetEntryValue(PwDefs.TitleField); }
|
||||||
public string URL { get; private set; }
|
set { SetEntryValue(PwDefs.TitleField, value); }
|
||||||
public string Notes { get; private set; }
|
}
|
||||||
|
public string UserName
|
||||||
|
{
|
||||||
|
get { return GetEntryValue(PwDefs.UserNameField); }
|
||||||
|
set { SetEntryValue(PwDefs.UserNameField, value); }
|
||||||
|
}
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get { return GetEntryValue(PwDefs.PasswordField); }
|
||||||
|
set { SetEntryValue(PwDefs.PasswordField, value); }
|
||||||
|
}
|
||||||
|
public string Url
|
||||||
|
{
|
||||||
|
get { return GetEntryValue(PwDefs.UrlField); }
|
||||||
|
set { SetEntryValue(PwDefs.UrlField, value); }
|
||||||
|
}
|
||||||
|
public string Notes
|
||||||
|
{
|
||||||
|
get { return GetEntryValue(PwDefs.NotesField); }
|
||||||
|
set { SetEntryValue(PwDefs.NotesField, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
private readonly PwEntry _pwEntry;
|
||||||
|
|
||||||
public EntryVm() { }
|
public EntryVm() { }
|
||||||
public EntryVm(PwEntry entry)
|
public EntryVm(PwEntry entry)
|
||||||
{
|
{
|
||||||
Title = entry.Strings.GetSafe(PwDefs.TitleField).ReadString();
|
_pwEntry = entry;
|
||||||
UserName = entry.Strings.GetSafe(PwDefs.UserNameField).ReadString();
|
|
||||||
Password = entry.Strings.GetSafe(PwDefs.PasswordField).ReadString();
|
|
||||||
URL = entry.Strings.GetSafe(PwDefs.UrlField).ReadString();
|
|
||||||
Notes = entry.Strings.GetSafe(PwDefs.NotesField).ReadString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
private string GetEntryValue(string key)
|
||||||
|
{
|
||||||
|
return _pwEntry.Strings.GetSafe(key).ReadString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetEntryValue(string key, string newValue)
|
||||||
|
{
|
||||||
|
_pwEntry.Strings.Set(key, new ProtectedString(true, newValue));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<package id="Microsoft.Bcl.Compression" version="3.9.85" targetFramework="win81" />
|
<package id="Microsoft.Bcl.Compression" version="3.9.85" targetFramework="win81" />
|
||||||
<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="ModernKeePassLibPCL" version="2.28.1.31251" targetFramework="win81" />
|
<package id="ModernKeePassLibPCL" version="2.28.1.25559" targetFramework="win81" />
|
||||||
<package id="NETStandard.Library" version="2.0.0" targetFramework="win81" />
|
<package id="NETStandard.Library" version="2.0.0" targetFramework="win81" />
|
||||||
<package id="PCLCrypto" version="2.0.147" targetFramework="win81" />
|
<package id="PCLCrypto" version="2.0.147" targetFramework="win81" />
|
||||||
<package id="PCLStorage" version="1.0.2" targetFramework="win81" />
|
<package id="PCLStorage" version="1.0.2" targetFramework="win81" />
|
||||||
|
@@ -33,42 +33,13 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ModernKeePassLibPCL, Version=2.28.1.32947, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="crypto">
|
||||||
<HintPath>..\packages\ModernKeePassLibPCL.2.28.1.32947\lib\portable46-net451+win81+wpa81\ModernKeePassLibPCL.dll</HintPath>
|
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.1\lib\portable-net4+sl5+wp8+win8+wpa81\crypto.dll</HintPath>
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PCLCrypto, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d4421c8a4786956c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PCLCrypto.2.0.147\lib\net45\PCLCrypto.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PCLStorage.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.Abstractions.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.BCrypt, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.BCrypt.0.5.97\lib\net45\PInvoke.BCrypt.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.Kernel32, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.Kernel32.0.5.97\lib\net45\PInvoke.Kernel32.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.NCrypt, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.NCrypt.0.5.97\lib\net45\PInvoke.NCrypt.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="PInvoke.Windows.Core, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\PInvoke.Windows.Core.0.5.97\lib\net35\PInvoke.Windows.Core.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</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">
|
||||||
<HintPath>..\packages\Splat.2.0.0\lib\Net45\Splat.dll</HintPath>
|
<HintPath>..\packages\Splat.2.0.0\lib\Net45\Splat.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@@ -78,13 +49,8 @@
|
|||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<Reference Include="Windows">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\ModernKeePassLib\Libs\Windows.winmd</HintPath>
|
||||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1\System.Runtime.WindowsRuntime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Validation, Version=2.4.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Validation.2.4.15\lib\net45\Validation.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -106,6 +72,12 @@
|
|||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ModernKeePassLib\ModernKeePassLibPCL.csproj">
|
||||||
|
<Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project>
|
||||||
|
<Name>ModernKeePassLibPCL</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
@@ -14,6 +14,10 @@
|
|||||||
<assemblyIdentity name="Validation" publicKeyToken="2fc06f0d701809a7" culture="neutral" />
|
<assemblyIdentity name="Validation" publicKeyToken="2fc06f0d701809a7" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.WindowsRuntime" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
@@ -1,15 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net462" />
|
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net462" />
|
||||||
<package id="Microsoft.Bcl.Compression" version="3.9.85" targetFramework="net462" />
|
|
||||||
<package id="ModernKeePassLibPCL" version="2.28.1.32947" targetFramework="net462" />
|
|
||||||
<package id="NUnit" version="3.8.1" targetFramework="net452" />
|
<package id="NUnit" version="3.8.1" targetFramework="net452" />
|
||||||
<package id="PCLCrypto" version="2.0.147" targetFramework="net462" />
|
|
||||||
<package id="PCLStorage" version="1.0.2" targetFramework="net462" />
|
|
||||||
<package id="PInvoke.BCrypt" version="0.5.97" targetFramework="net462" />
|
|
||||||
<package id="PInvoke.Kernel32" version="0.5.97" targetFramework="net462" />
|
|
||||||
<package id="PInvoke.NCrypt" version="0.5.97" targetFramework="net462" />
|
|
||||||
<package id="PInvoke.Windows.Core" version="0.5.97" targetFramework="net462" />
|
|
||||||
<package id="Splat" version="2.0.0" targetFramework="net462" />
|
<package id="Splat" version="2.0.0" targetFramework="net462" />
|
||||||
<package id="Validation" version="2.4.15" targetFramework="net462" />
|
|
||||||
</packages>
|
</packages>
|
@@ -43,6 +43,12 @@ using Org.BouncyCastle.Crypto.Parameters;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
using ModernKeePassLibPCL.Resources;
|
using ModernKeePassLibPCL.Resources;
|
||||||
|
using Org.BouncyCastle.Crypto;
|
||||||
|
using Org.BouncyCastle.Crypto.Engines;
|
||||||
|
using Org.BouncyCastle.Crypto.IO;
|
||||||
|
using Org.BouncyCastle.Crypto.Modes;
|
||||||
|
using Org.BouncyCastle.Crypto.Paddings;
|
||||||
|
using Org.BouncyCastle.Crypto.Parameters;
|
||||||
|
|
||||||
namespace ModernKeePassLibPCL.Cryptography.Cipher
|
namespace ModernKeePassLibPCL.Cryptography.Cipher
|
||||||
{
|
{
|
||||||
@@ -123,8 +129,8 @@ namespace ModernKeePassLibPCL.Cryptography.Cipher
|
|||||||
|
|
||||||
byte[] pbLocalKey = new byte[32];
|
byte[] pbLocalKey = new byte[32];
|
||||||
Array.Copy(pbKey, pbLocalKey, 32);
|
Array.Copy(pbKey, pbLocalKey, 32);
|
||||||
|
#if !ModernKeePassLibPCL
|
||||||
#if ModernKeePassLibPCL
|
//#if ModernKeePassLibPCL
|
||||||
/*var provider = WinRTCrypto.SymmetricKeyAlgorithmProvider.
|
/*var provider = WinRTCrypto.SymmetricKeyAlgorithmProvider.
|
||||||
OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7);
|
OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7);
|
||||||
var key = provider.CreateSymmetricKey(pbLocalKey);
|
var key = provider.CreateSymmetricKey(pbLocalKey);
|
||||||
@@ -140,9 +146,11 @@ namespace ModernKeePassLibPCL.Cryptography.Cipher
|
|||||||
return new CryptoStream(s, decryptor, CryptoStreamMode.Read);
|
return new CryptoStream(s, decryptor, CryptoStreamMode.Read);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var provider = SymmetricKeyAlgorithmProvider.
|
var provider = SymmetricKeyAlgorithmProvider.
|
||||||
OpenAlgorithm(SymmetricAlgorithmNames.AesCbcPkcs7);
|
OpenAlgorithm(SymmetricAlgorithmNames.AesCbcPkcs7);
|
||||||
var key = provider.CreateSymmetricKey(CryptographicBuffer.CreateFromByteArray(pbLocalKey));
|
var key = provider.CreateSymmetricKey(CryptographicBuffer.CreateFromByteArray(pbLocalKey));
|
||||||
|
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
s.CopyTo(ms);
|
s.CopyTo(ms);
|
||||||
@@ -152,18 +160,21 @@ namespace ModernKeePassLibPCL.Cryptography.Cipher
|
|||||||
{
|
{
|
||||||
var encrypted = CryptographicEngine.Encrypt(key, data, CryptographicBuffer.CreateFromByteArray(pbLocalIV));
|
var encrypted = CryptographicEngine.Encrypt(key, data, CryptographicBuffer.CreateFromByteArray(pbLocalIV));
|
||||||
CryptographicBuffer.CopyToByteArray(encrypted, out resultByteArray);
|
CryptographicBuffer.CopyToByteArray(encrypted, out resultByteArray);
|
||||||
|
return new MemoryStream(resultByteArray);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var decrypted = CryptographicEngine.Decrypt(key, data, CryptographicBuffer.CreateFromByteArray(pbLocalIV));
|
var decrypted = CryptographicEngine.Decrypt(key, data, CryptographicBuffer.CreateFromByteArray(pbLocalIV));
|
||||||
CryptographicBuffer.CopyToByteArray(decrypted, out resultByteArray);
|
CryptographicBuffer.CopyToByteArray(decrypted, out resultByteArray);
|
||||||
}
|
|
||||||
return new MemoryStream(resultByteArray, true);
|
return new MemoryStream(resultByteArray, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
#if !KeePassRT
|
//#else
|
||||||
RijndaelManaged r = new RijndaelManaged();
|
|
||||||
|
//#if !KeePassRT
|
||||||
|
//#if !ModernKeePassLibPCL
|
||||||
|
RijndaelManaged r = new RijndaelManaged();
|
||||||
if(r.BlockSize != 128) // AES block size
|
if(r.BlockSize != 128) // AES block size
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
@@ -183,6 +194,7 @@ namespace ModernKeePassLibPCL.Cryptography.Cipher
|
|||||||
return new CryptoStream(s, iTransform, bEncrypt ? CryptoStreamMode.Write :
|
return new CryptoStream(s, iTransform, bEncrypt ? CryptoStreamMode.Write :
|
||||||
CryptoStreamMode.Read);
|
CryptoStreamMode.Read);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
AesEngine aes = new AesEngine();
|
AesEngine aes = new AesEngine();
|
||||||
CbcBlockCipher cbc = new CbcBlockCipher(aes);
|
CbcBlockCipher cbc = new CbcBlockCipher(aes);
|
||||||
PaddedBufferedBlockCipher bc = new PaddedBufferedBlockCipher(cbc,
|
PaddedBufferedBlockCipher bc = new PaddedBufferedBlockCipher(cbc,
|
||||||
@@ -196,7 +208,7 @@ namespace ModernKeePassLibPCL.Cryptography.Cipher
|
|||||||
return new CipherStream(s, cpRead, cpWrite);
|
return new CipherStream(s, cpRead, cpWrite);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream EncryptStream(Stream sPlainText, byte[] pbKey, byte[] pbIV)
|
public Stream EncryptStream(Stream sPlainText, byte[] pbKey, byte[] pbIV)
|
||||||
|
@@ -23,13 +23,16 @@ using System.Text;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
#if ModernKeePassLibPCL
|
#if ModernKeePassLibPCL
|
||||||
using Windows.Security.Cryptography;
|
using Windows.Security.Cryptography;
|
||||||
|
using Windows.Security.Cryptography.Core;
|
||||||
|
using Org.BouncyCastle.Crypto;
|
||||||
|
using Org.BouncyCastle.Crypto.Digests;
|
||||||
#else
|
#else
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
#endif
|
#endif
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices.ComTypes;
|
||||||
using ModernKeePassLibPCL.Utility;
|
using ModernKeePassLibPCL.Utility;
|
||||||
using Windows.Security.Cryptography.Core;
|
using Org.BouncyCastle.Crypto.Tls;
|
||||||
|
|
||||||
namespace ModernKeePassLibPCL.Cryptography
|
namespace ModernKeePassLibPCL.Cryptography
|
||||||
{
|
{
|
||||||
@@ -39,7 +42,8 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
private bool m_bWriting;
|
private bool m_bWriting;
|
||||||
#if ModernKeePassLibPCL
|
#if ModernKeePassLibPCL
|
||||||
//private ICryptoTransform m_hash;
|
//private ICryptoTransform m_hash;
|
||||||
private CryptographicHash m_hash;
|
//private CryptographicHash m_hash;
|
||||||
|
private IDigest m_hash;
|
||||||
#else
|
#else
|
||||||
private HashAlgorithm m_hash;
|
private HashAlgorithm m_hash;
|
||||||
#endif
|
#endif
|
||||||
@@ -53,7 +57,7 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
|
|
||||||
public override bool CanRead
|
public override bool CanRead
|
||||||
{
|
{
|
||||||
get { return /*!m_bWriting;*/true; }
|
get { return !m_bWriting; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanSeek
|
public override bool CanSeek
|
||||||
@@ -91,7 +95,8 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
m_bWriting = bWriting;
|
m_bWriting = bWriting;
|
||||||
#if ModernKeePassLibPCL
|
#if ModernKeePassLibPCL
|
||||||
//m_hash = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm ?? HashAlgorithm.Sha256).CreateHash();
|
//m_hash = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm ?? HashAlgorithm.Sha256).CreateHash();
|
||||||
m_hash = HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm ?? HashAlgorithmNames.Sha256).CreateHash();
|
//m_hash = HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm ?? HashAlgorithmNames.Sha256).CreateHash();
|
||||||
|
m_hash = new Sha256Digest();
|
||||||
#elif !KeePassLibSD
|
#elif !KeePassLibSD
|
||||||
m_hash = (hashAlgorithm ?? new SHA256Managed());
|
m_hash = (hashAlgorithm ?? new SHA256Managed());
|
||||||
#else // KeePassLibSD
|
#else // KeePassLibSD
|
||||||
@@ -135,7 +140,10 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
//m_hash.TransformFinalBlock(new byte[0], 0, 0);
|
//m_hash.TransformFinalBlock(new byte[0], 0, 0);
|
||||||
#if ModernKeePassLibPCL
|
#if ModernKeePassLibPCL
|
||||||
//m_pbFinalHash = (m_hash as CryptographicHash).GetValueAndReset ();
|
//m_pbFinalHash = (m_hash as CryptographicHash).GetValueAndReset ();
|
||||||
CryptographicBuffer.CopyToByteArray(m_hash.GetValueAndReset(), out m_pbFinalHash);
|
//CryptographicBuffer.CopyToByteArray(m_hash.GetValueAndReset(), out m_pbFinalHash);
|
||||||
|
m_pbFinalHash = new byte[32];
|
||||||
|
m_hash.DoFinal(m_pbFinalHash, 0);
|
||||||
|
m_hash.Reset();
|
||||||
#else
|
#else
|
||||||
m_pbFinalHash = m_hash.Hash;
|
m_pbFinalHash = m_hash.Hash;
|
||||||
#endif
|
#endif
|
||||||
@@ -160,7 +168,7 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
|
|
||||||
public override int Read(byte[] pbBuffer, int nOffset, int nCount)
|
public override int Read(byte[] pbBuffer, int nOffset, int nCount)
|
||||||
{
|
{
|
||||||
//if(m_bWriting) throw new InvalidOperationException();
|
if(m_bWriting) throw new InvalidOperationException();
|
||||||
|
|
||||||
int nRead = m_sBaseStream.Read(pbBuffer, nOffset, nCount);
|
int nRead = m_sBaseStream.Read(pbBuffer, nOffset, nCount);
|
||||||
int nPartialRead = nRead;
|
int nPartialRead = nRead;
|
||||||
@@ -178,7 +186,8 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
|
|
||||||
if((m_hash != null) && (nRead > 0))
|
if((m_hash != null) && (nRead > 0))
|
||||||
//m_hash.TransformBlock(pbBuffer, nOffset, nRead, pbBuffer, nOffset);
|
//m_hash.TransformBlock(pbBuffer, nOffset, nRead, pbBuffer, nOffset);
|
||||||
m_hash.Append(CryptographicBuffer.CreateFromByteArray(pbBuffer));
|
//m_hash.Append(CryptographicBuffer.CreateFromByteArray(pbBuffer));
|
||||||
|
m_hash.BlockUpdate(pbBuffer, nOffset, nRead);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Debug.Assert(MemUtil.ArraysEqual(pbBuffer, pbOrg));
|
Debug.Assert(MemUtil.ArraysEqual(pbBuffer, pbOrg));
|
||||||
@@ -198,10 +207,10 @@ namespace ModernKeePassLibPCL.Cryptography
|
|||||||
|
|
||||||
if ((m_hash != null) && (nCount > 0))
|
if ((m_hash != null) && (nCount > 0))
|
||||||
//m_hash.TransformBlock(pbBuffer, nOffset, nCount, pbBuffer, nOffset);
|
//m_hash.TransformBlock(pbBuffer, nOffset, nCount, pbBuffer, nOffset);
|
||||||
m_hash.Append(CryptographicBuffer.CreateFromByteArray(pbBuffer));
|
//m_hash.Append(CryptographicBuffer.CreateFromByteArray(pbBuffer));
|
||||||
|
m_hash.BlockUpdate(pbBuffer, nOffset, nCount);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Debug.Assert(MemUtil.ArraysEqual(pbBuffer, pbOrg));
|
Debug.Assert(MemUtil.ArraysEqual(pbBuffer, pbOrg));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_sBaseStream.Write(pbBuffer, nOffset, nCount);
|
m_sBaseStream.Write(pbBuffer, nOffset, nCount);
|
||||||
|
@@ -322,7 +322,7 @@ namespace ModernKeePassLibPCL.Keys
|
|||||||
|
|
||||||
#if ModernKeePassLibPCL
|
#if ModernKeePassLibPCL
|
||||||
var settings = new XmlWriterSettings() { Encoding = StrUtil.Utf8 };
|
var settings = new XmlWriterSettings() { Encoding = StrUtil.Utf8 };
|
||||||
var xtw = XmlWriter.Create(sOut.AsStream(), settings);
|
var xtw = XmlWriter.Create(sOut, settings);
|
||||||
#else
|
#else
|
||||||
XmlTextWriter xtw = new XmlTextWriter(sOut, StrUtil.Utf8);
|
XmlTextWriter xtw = new XmlTextWriter(sOut, StrUtil.Utf8);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
|
|
||||||
<NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ImportGroup>
|
|
||||||
<Import Project="$(NuGetPackageRoot)\Microsoft.Bcl.Build\1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('$(NuGetPackageRoot)\Microsoft.Bcl.Build\1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
@@ -129,7 +129,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(s == null) return null;
|
if(s == null) return null;
|
||||||
using (var sr = new StreamReader(s.AsStream(), StrUtil.Utf8))
|
using (var sr = new StreamReader(s, StrUtil.Utf8))
|
||||||
{
|
{
|
||||||
string str = sr.ReadToEnd();
|
string str = sr.ReadToEnd();
|
||||||
if (str == null)
|
if (str == null)
|
||||||
@@ -179,7 +179,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
{
|
{
|
||||||
byte[] pbFile = StrUtil.Utf8.GetBytes(sb.ToString());
|
byte[] pbFile = StrUtil.Utf8.GetBytes(sb.ToString());
|
||||||
if (s == null) throw new IOException(iocLockFile.GetDisplayName());
|
if (s == null) throw new IOException(iocLockFile.GetDisplayName());
|
||||||
s.WriteAsync(pbFile.AsBuffer()).GetAwaiter().GetResult();
|
s.WriteAsync(pbFile, 0, pbFile.Length).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
return lfi;
|
return lfi;
|
||||||
|
@@ -79,7 +79,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
else m_iocTemp = m_iocBase;
|
else m_iocTemp = m_iocBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRandomAccessStream OpenWrite()
|
public Stream OpenWrite()
|
||||||
{
|
{
|
||||||
if(!m_bTransacted) m_bMadeUnhidden = UrlUtil.UnhideFile(m_iocTemp.Path);
|
if(!m_bTransacted) m_bMadeUnhidden = UrlUtil.UnhideFile(m_iocTemp.Path);
|
||||||
else // m_bTransacted
|
else // m_bTransacted
|
||||||
@@ -100,7 +100,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void CommitWriteTransaction()
|
private void CommitWriteTransaction()
|
||||||
{
|
{
|
||||||
bool bMadeUnhidden = UrlUtil.UnhideFile(m_iocBase.Path);
|
bool bMadeUnhidden = UrlUtil.UnhideFile(m_iocBase.Path);
|
||||||
|
|
||||||
|
@@ -422,7 +422,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
new Uri(ioc.Path)));
|
new Uri(ioc.Path)));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public static IRandomAccessStream OpenRead(IOConnectionInfo ioc)
|
public static Stream OpenRead(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
RaiseIOAccessPreEvent(ioc, IOAccessType.Read);
|
RaiseIOAccessPreEvent(ioc, IOAccessType.Read);
|
||||||
|
|
||||||
@@ -430,9 +430,9 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private static IRandomAccessStream OpenReadLocal(IOConnectionInfo ioc)
|
private static Stream OpenReadLocal(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
return ioc.StorageFile.OpenAsync(FileAccessMode.Read).GetAwaiter().GetResult();
|
return ioc.StorageFile.OpenAsync(FileAccessMode.Read).GetAwaiter().GetResult().AsStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT)
|
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT)
|
||||||
@@ -458,7 +458,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
return IocStream.WrapIfRequired(s);
|
return IocStream.WrapIfRequired(s);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public static IRandomAccessStream OpenWrite(IOConnectionInfo ioc)
|
public static Stream OpenWrite(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
RaiseIOAccessPreEvent(ioc, IOAccessType.Write);
|
RaiseIOAccessPreEvent(ioc, IOAccessType.Write);
|
||||||
|
|
||||||
@@ -466,9 +466,9 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private static IRandomAccessStream OpenWriteLocal(IOConnectionInfo ioc)
|
private static Stream OpenWriteLocal(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
return ioc.StorageFile.OpenAsync(FileAccessMode.ReadWrite).GetAwaiter().GetResult();
|
return ioc.StorageFile.OpenAsync(FileAccessMode.ReadWrite).GetAwaiter().GetResult().AsStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool FileExists(IOConnectionInfo ioc)
|
public static bool FileExists(IOConnectionInfo ioc)
|
||||||
@@ -546,7 +546,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
#endif
|
#endif
|
||||||
public static byte[] ReadFile(IOConnectionInfo ioc)
|
public static byte[] ReadFile(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
IRandomAccessStream sIn = null;
|
Stream sIn = null;
|
||||||
MemoryStream ms = null;
|
MemoryStream ms = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -555,7 +555,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
|
|
||||||
ms = new MemoryStream();
|
ms = new MemoryStream();
|
||||||
|
|
||||||
MemUtil.CopyStream(sIn.AsStream(), ms);
|
MemUtil.CopyStream(sIn, ms);
|
||||||
|
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
|
@@ -71,7 +71,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
/// a KDBX stream.</param>
|
/// a KDBX stream.</param>
|
||||||
/// <param name="kdbFormat">Format specifier.</param>
|
/// <param name="kdbFormat">Format specifier.</param>
|
||||||
/// <param name="slLogger">Status logger (optional).</param>
|
/// <param name="slLogger">Status logger (optional).</param>
|
||||||
public void Load(IRandomAccessStream sSource, KdbxFormat kdbFormat, IStatusLogger slLogger)
|
public void Load(Stream sSource, KdbxFormat kdbFormat, IStatusLogger slLogger)
|
||||||
{
|
{
|
||||||
Debug.Assert(sSource != null);
|
Debug.Assert(sSource != null);
|
||||||
if(sSource == null) throw new ArgumentNullException("sSource");
|
if(sSource == null) throw new ArgumentNullException("sSource");
|
||||||
@@ -79,7 +79,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
m_format = kdbFormat;
|
m_format = kdbFormat;
|
||||||
m_slLogger = slLogger;
|
m_slLogger = slLogger;
|
||||||
|
|
||||||
HashingStreamEx hashedStream = new HashingStreamEx(sSource.AsStream(), false, null);
|
HashingStreamEx hashedStream = new HashingStreamEx(sSource, false, null);
|
||||||
|
|
||||||
UTF8Encoding encNoBom = StrUtil.Utf8;
|
UTF8Encoding encNoBom = StrUtil.Utf8;
|
||||||
try
|
try
|
||||||
@@ -165,7 +165,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
finally { CommonCleanUpRead(sSource, hashedStream); }
|
finally { CommonCleanUpRead(sSource, hashedStream); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CommonCleanUpRead(IRandomAccessStream sSource, HashingStreamEx hashedStream)
|
private void CommonCleanUpRead(Stream sSource, HashingStreamEx hashedStream)
|
||||||
{
|
{
|
||||||
hashedStream.Dispose();
|
hashedStream.Dispose();
|
||||||
m_pbHashOfFileOnDisk = hashedStream.Hash;
|
m_pbHashOfFileOnDisk = hashedStream.Hash;
|
||||||
@@ -376,7 +376,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public static List<PwEntry> ReadEntries(PwDatabase pwDatabase, IRandomAccessStream msData)
|
public static List<PwEntry> ReadEntries(PwDatabase pwDatabase, Stream msData)
|
||||||
{
|
{
|
||||||
return ReadEntries(msData);
|
return ReadEntries(msData);
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msData">Input stream to read the entries from.</param>
|
/// <param name="msData">Input stream to read the entries from.</param>
|
||||||
/// <returns>Extracted entries.</returns>
|
/// <returns>Extracted entries.</returns>
|
||||||
public static List<PwEntry> ReadEntries(IRandomAccessStream msData)
|
public static List<PwEntry> ReadEntries(Stream msData)
|
||||||
{
|
{
|
||||||
/* KdbxFile f = new KdbxFile(pwDatabase);
|
/* KdbxFile f = new KdbxFile(pwDatabase);
|
||||||
f.m_format = KdbxFormat.PlainXml;
|
f.m_format = KdbxFormat.PlainXml;
|
||||||
|
@@ -77,7 +77,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
/// be written.</param>
|
/// be written.</param>
|
||||||
/// <param name="format">Format of the file to create.</param>
|
/// <param name="format">Format of the file to create.</param>
|
||||||
/// <param name="slLogger">Logger that recieves status information.</param>
|
/// <param name="slLogger">Logger that recieves status information.</param>
|
||||||
public void Save(IRandomAccessStream sSaveTo, PwGroup pgDataSource, KdbxFormat format,
|
public void Save(Stream sSaveTo, PwGroup pgDataSource, KdbxFormat format,
|
||||||
IStatusLogger slLogger)
|
IStatusLogger slLogger)
|
||||||
{
|
{
|
||||||
Debug.Assert(sSaveTo != null);
|
Debug.Assert(sSaveTo != null);
|
||||||
@@ -86,7 +86,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
m_format = format;
|
m_format = format;
|
||||||
m_slLogger = slLogger;
|
m_slLogger = slLogger;
|
||||||
|
|
||||||
HashingStreamEx hashedStream = new HashingStreamEx(sSaveTo.AsStream(), true, null);
|
HashingStreamEx hashedStream = new HashingStreamEx(sSaveTo, true, null);
|
||||||
|
|
||||||
UTF8Encoding encNoBom = StrUtil.Utf8;
|
UTF8Encoding encNoBom = StrUtil.Utf8;
|
||||||
CryptoRandom cr = CryptoRandom.Instance;
|
CryptoRandom cr = CryptoRandom.Instance;
|
||||||
@@ -146,7 +146,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
finally { CommonCleanUpWrite(sSaveTo, hashedStream); }
|
finally { CommonCleanUpWrite(sSaveTo, hashedStream); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CommonCleanUpWrite(IRandomAccessStream sSaveTo, HashingStreamEx hashedStream)
|
private void CommonCleanUpWrite(Stream sSaveTo, HashingStreamEx hashedStream)
|
||||||
{
|
{
|
||||||
hashedStream.Dispose();
|
hashedStream.Dispose();
|
||||||
m_pbHashOfFileOnDisk = hashedStream.Hash;
|
m_pbHashOfFileOnDisk = hashedStream.Hash;
|
||||||
@@ -836,7 +836,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public static bool WriteEntries(IRandomAccessStream msOutput, PwDatabase pwDatabase,
|
public static bool WriteEntries(Stream msOutput, PwDatabase pwDatabase,
|
||||||
PwEntry[] vEntries)
|
PwEntry[] vEntries)
|
||||||
{
|
{
|
||||||
return WriteEntries(msOutput, vEntries);
|
return WriteEntries(msOutput, vEntries);
|
||||||
@@ -849,7 +849,7 @@ namespace ModernKeePassLibPCL.Serialization
|
|||||||
/// <param name="vEntries">Entries to serialize.</param>
|
/// <param name="vEntries">Entries to serialize.</param>
|
||||||
/// <returns>Returns <c>true</c>, if the entries were written successfully
|
/// <returns>Returns <c>true</c>, if the entries were written successfully
|
||||||
/// to the stream.</returns>
|
/// to the stream.</returns>
|
||||||
public static bool WriteEntries(IRandomAccessStream msOutput, PwEntry[] vEntries)
|
public static bool WriteEntries(Stream msOutput, PwEntry[] vEntries)
|
||||||
{
|
{
|
||||||
/* KdbxFile f = new KdbxFile(pwDatabase);
|
/* KdbxFile f = new KdbxFile(pwDatabase);
|
||||||
f.m_format = KdbxFormat.PlainXml;
|
f.m_format = KdbxFormat.PlainXml;
|
||||||
|
@@ -2,6 +2,10 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.WindowsRuntime" publicKeyToken="B77A5C561934E089" culture="neutral"/>
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0"/>
|
||||||
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Xml.XmlSerializer" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
|
<assemblyIdentity name="System.Xml.XmlSerializer" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"supports": {},
|
"supports": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Bcl.Build": "1.0.21",
|
|
||||||
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
||||||
"NETStandard.Library": "1.6.0",
|
"NETStandard.Library": "1.6.0",
|
||||||
"PInvoke.Windows.Core": "0.5.97",
|
"PInvoke.Windows.Core": "0.5.97",
|
||||||
|
@@ -3,9 +3,6 @@
|
|||||||
"version": 2,
|
"version": 2,
|
||||||
"targets": {
|
"targets": {
|
||||||
".NETStandard,Version=v1.2": {
|
".NETStandard,Version=v1.2": {
|
||||||
"Microsoft.Bcl.Build/1.0.21": {
|
|
||||||
"type": "package"
|
|
||||||
},
|
|
||||||
"Microsoft.NETCore.Jit/1.0.2": {
|
"Microsoft.NETCore.Jit/1.0.2": {
|
||||||
"type": "package"
|
"type": "package"
|
||||||
},
|
},
|
||||||
@@ -545,17 +542,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libraries": {
|
"libraries": {
|
||||||
"Microsoft.Bcl.Build/1.0.21": {
|
|
||||||
"sha512": "sgHu4mIt0+NVGyI12Bj4hLPypNK55UOH+ologj2LqDCjxq3EbIxe/uAtHjY+fEwbE1dtsAHG8SXHf+V/EYbKTg==",
|
|
||||||
"type": "package",
|
|
||||||
"files": [
|
|
||||||
"License-Stable.rtf",
|
|
||||||
"Microsoft.Bcl.Build.1.0.21.nupkg.sha512",
|
|
||||||
"Microsoft.Bcl.Build.nuspec",
|
|
||||||
"build/Microsoft.Bcl.Build.Tasks.dll",
|
|
||||||
"build/Microsoft.Bcl.Build.targets"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Microsoft.NETCore.Jit/1.0.2": {
|
"Microsoft.NETCore.Jit/1.0.2": {
|
||||||
"sha512": "Ok2vWofa6X8WD9vc4pfLHwvJz1/B6t3gOAoZcjrjrQf7lQOlNIuZIZtLn3wnWX28DuQGpPJkRlBxFj7Z5txNqw==",
|
"sha512": "Ok2vWofa6X8WD9vc4pfLHwvJz1/B6t3gOAoZcjrjrQf7lQOlNIuZIZtLn3wnWX28DuQGpPJkRlBxFj7Z5txNqw==",
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -2959,7 +2945,6 @@
|
|||||||
},
|
},
|
||||||
"projectFileDependencyGroups": {
|
"projectFileDependencyGroups": {
|
||||||
"": [
|
"": [
|
||||||
"Microsoft.Bcl.Build >= 1.0.21",
|
|
||||||
"Microsoft.NETCore.Portable.Compatibility >= 1.0.1",
|
"Microsoft.NETCore.Portable.Compatibility >= 1.0.1",
|
||||||
"NETStandard.Library >= 1.6.0",
|
"NETStandard.Library >= 1.6.0",
|
||||||
"PInvoke.Windows.Core >= 0.5.97",
|
"PInvoke.Windows.Core >= 0.5.97",
|
||||||
|
Reference in New Issue
Block a user