Write-mode is finally working!!!

Lib uses BouncyCastle crypto
This commit is contained in:
2017-09-26 14:32:15 +02:00
parent 22ea657885
commit 27aaa8023a
22 changed files with 133 additions and 178 deletions

View File

@@ -163,32 +163,8 @@
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.1\lib\netstandard1.0\crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ModernKeePassLibPCL, Version=2.28.1.31251, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLibPCL.2.28.1.31251\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>
<Reference Include="ModernKeePassLibPCL, Version=2.28.1.25559, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLibPCL.2.28.1.25559\lib\netstandard1.2\ModernKeePassLibPCL.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PInvoke.Windows.Core, Version=0.5.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">

View File

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

View File

@@ -1,17 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using ModernKeePass.Common;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
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 ModernKeePass.ViewModels;
@@ -31,10 +21,7 @@ namespace ModernKeePass.Pages
/// NavigationHelper est utilisé sur chaque page pour faciliter la navigation et
/// gestion de la durée de vie des processus
/// </summary>
public NavigationHelper NavigationHelper
{
get { return this.navigationHelper; }
}
public NavigationHelper NavigationHelper => navigationHelper;
public EntryDetailPage()
{
@@ -51,16 +38,11 @@ namespace ModernKeePass.Pages
/// Source de l'événement ; en général <see cref="Common.NavigationHelper"/>
/// </param>
/// <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
/// 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)
{
object navigationParameter;
if (e.PageState != null && e.PageState.ContainsKey("SelectedItem"))
{
navigationParameter = e.PageState["SelectedItem"];
}
}
#region Inscription de NavigationHelper

View File

@@ -1,4 +1,5 @@
using ModernKeePass.Common;
using System;
using ModernKeePass.Common;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using ModernKeePass.ViewModels;
@@ -19,10 +20,7 @@ namespace ModernKeePass.Pages
/// NavigationHelper is used on each page to aid in navigation and
/// process lifetime management
/// </summary>
public NavigationHelper NavigationHelper
{
get { return navigationHelper; }
}
public NavigationHelper NavigationHelper => navigationHelper;
public GroupDetailPage()
@@ -40,7 +38,7 @@ namespace ModernKeePass.Pages
/// The source of the event; typically <see cref="Common.NavigationHelper"/>
/// </param>
/// <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
/// session. The state will be null the first time a page is visited.</param>
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)

View File

@@ -1,26 +1,55 @@
using System.ComponentModel;
using ModernKeePassLibPCL;
using ModernKeePassLibPCL.Security;
namespace ModernKeePass.ViewModels
{
public class EntryVm : INotifyPropertyChanged
{
public string Title { get; set; }
public string UserName { get; private set; }
public string Password { get; private set; }
public string URL { get; private set; }
public string Notes { get; private set; }
public string Title
{
get { return GetEntryValue(PwDefs.TitleField); }
set { SetEntryValue(PwDefs.TitleField, value); }
}
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(PwEntry entry)
{
Title = entry.Strings.GetSafe(PwDefs.TitleField).ReadString();
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();
_pwEntry = entry;
}
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));
}
}
}

View File

@@ -4,7 +4,7 @@
<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.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="PCLCrypto" version="2.0.147" targetFramework="win81" />
<package id="PCLStorage" version="1.0.2" targetFramework="win81" />