ModernKeePassLib namespace restoration

This commit is contained in:
2017-09-26 15:38:58 +02:00
parent 27aaa8023a
commit 1faa26473d
114 changed files with 785 additions and 747 deletions

1
.gitignore vendored
View File

@@ -35,3 +35,4 @@ Translation/TrlUtil.vshost.exe.manifest
.vs/ .vs/
/UpgradeLog.htm /UpgradeLog.htm
packages/ packages/
project.lock.json

View File

@@ -5,7 +5,7 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePass", "ModernKeePass\ModernKeePass.csproj", "{A0CFC681-769B-405A-8482-0CDEE595A91F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePass", "ModernKeePass\ModernKeePass.csproj", "{A0CFC681-769B-405A-8482-0CDEE595A91F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLibPCL", "ModernKeePassLib\ModernKeePassLibPCL.csproj", "{2E710089-9559-4967-846C-E763DD1F3ACB}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLib", "ModernKeePassLib\ModernKeePassLib.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 ProjectSection(ProjectDependencies) = postProject

View File

@@ -2,10 +2,10 @@
using Windows.Storage; using Windows.Storage;
using System.Threading.Tasks; using System.Threading.Tasks;
using ModernKeePass.ViewModels; using ModernKeePass.ViewModels;
using ModernKeePassLibPCL; using ModernKeePassLib;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
namespace ModernKeePass.Common namespace ModernKeePass.Common
{ {

View File

@@ -159,30 +159,10 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<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.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">
<HintPath>..\packages\PInvoke.Windows.Core.0.5.97\lib\portable-net45+win8+wpa81\PInvoke.Windows.Core.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>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\win8\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\win8\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Validation, Version=2.4.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL">
<HintPath>..\packages\Validation.2.4.15\lib\portable-net45+win8+wp8+wpa81\Validation.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<ItemGroup> <ItemGroup>

View File

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

View File

@@ -1,6 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
using ModernKeePassLibPCL; using ModernKeePassLib;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
namespace ModernKeePass.ViewModels namespace ModernKeePass.ViewModels
{ {

View File

@@ -1,7 +1,7 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using ModernKeePassLibPCL; using ModernKeePassLib;
namespace ModernKeePass.ViewModels namespace ModernKeePass.ViewModels
{ {

View File

@@ -1,19 +1,8 @@
<?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="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.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="PCLStorage" version="1.0.2" targetFramework="win81" />
<package id="PInvoke.BCrypt" version="0.5.97" targetFramework="win81" />
<package id="PInvoke.Kernel32" version="0.5.97" targetFramework="win81" />
<package id="PInvoke.NCrypt" version="0.5.97" targetFramework="win81" />
<package id="PInvoke.Windows.Core" version="0.5.97" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.1" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" />
<package id="System.Collections" version="4.0.11" targetFramework="win81" /> <package id="System.Collections" version="4.0.11" targetFramework="win81" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="win81" /> <package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="win81" />
<package id="System.Globalization" version="4.0.11" targetFramework="win81" /> <package id="System.Globalization" version="4.0.11" targetFramework="win81" />
@@ -31,5 +20,4 @@
<package id="System.Threading.Tasks" version="4.0.11" targetFramework="win81" /> <package id="System.Threading.Tasks" version="4.0.11" targetFramework="win81" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="win81" />
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" />
<package id="Validation" version="2.4.15" targetFramework="win81" />
</packages> </packages>

View File

@@ -4,7 +4,7 @@ using System.IO;
#if KeePassLib #if KeePassLib
using KeePassLib.Cryptography.Cipher; using KeePassLib.Cryptography.Cipher;
#else #else
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
#endif #endif
using NUnit.Framework; using NUnit.Framework;

View File

@@ -4,7 +4,7 @@ using System;
#if KeePassLib #if KeePassLib
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
#else #else
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Cryptography namespace ModernKeePassLib.Test.Shared.Cryptography

View File

@@ -4,7 +4,7 @@ using System;
#if KeePassLib #if KeePassLib
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
#else #else
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Cryptography namespace ModernKeePassLib.Test.Shared.Cryptography

View File

@@ -6,7 +6,7 @@ using System.Text;
#if KeePassLib #if KeePassLib
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
#else #else
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Cryptography namespace ModernKeePassLib.Test.Shared.Cryptography

View File

@@ -5,7 +5,7 @@ using System.Text;
#if KeePassLib #if KeePassLib
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
#else #else
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Cryptography namespace ModernKeePassLib.Test.Shared.Cryptography

View File

@@ -4,7 +4,7 @@ using System;
#if KeePassLib #if KeePassLib
using KeePassLib.Keys; using KeePassLib.Keys;
#else #else
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Keys namespace ModernKeePassLib.Test.Shared.Keys

View File

@@ -4,7 +4,7 @@ using System;
#if KeePassLib #if KeePassLib
using KeePassLib.Keys; using KeePassLib.Keys;
#else #else
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Keys namespace ModernKeePassLib.Test.Shared.Keys

View File

@@ -5,7 +5,7 @@ using System.IO;
#if KeePassLib #if KeePassLib
using KeePassLib.Keys; using KeePassLib.Keys;
#else #else
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Keys namespace ModernKeePassLib.Test.Shared.Keys

View File

@@ -4,7 +4,7 @@ using System;
#if KeePassLib #if KeePassLib
using KeePassLib.Keys; using KeePassLib.Keys;
#else #else
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Keys namespace ModernKeePassLib.Test.Shared.Keys

View File

@@ -73,9 +73,9 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ModernKeePassLib\ModernKeePassLibPCL.csproj"> <ProjectReference Include="..\ModernKeePassLib\ModernKeePassLib.csproj">
<Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project> <Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project>
<Name>ModernKeePassLibPCL</Name> <Name>ModernKeePassLib</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -5,7 +5,7 @@ using System.IO;
#if KeePassLib #if KeePassLib
using KeePassLib.Serialization; using KeePassLib.Serialization;
#else #else
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Serialization namespace ModernKeePassLib.Test.Shared.Serialization

View File

@@ -12,11 +12,11 @@ using KeePassLib.Security;
using KeePassLib.Serialization; using KeePassLib.Serialization;
using KeePassLib.Collections; using KeePassLib.Collections;
#else #else
using ModernKeePassLibPCL; using ModernKeePassLib;
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Serialization namespace ModernKeePassLib.Test.Shared.Serialization

View File

@@ -5,7 +5,7 @@ using System;
using KeePassLib.Utility; using KeePassLib.Utility;
#else #else
using Splat; using Splat;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
#endif #endif
namespace ModernKeePassLib.Test.Shared.Utility namespace ModernKeePassLib.Test.Shared.Utility

View File

@@ -21,9 +21,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
namespace ModernKeePassLibPCL.Collections namespace ModernKeePassLib.Collections
{ {
[Flags] [Flags]
public enum AutoTypeObfuscationOptions public enum AutoTypeObfuscationOptions

View File

@@ -23,15 +23,15 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
#endif #endif
namespace ModernKeePassLibPCL.Collections namespace ModernKeePassLib.Collections
{ {
/// <summary> /// <summary>
/// A list of <c>ProtectedBinary</c> objects (dictionary). /// A list of <c>ProtectedBinary</c> objects (dictionary).

View File

@@ -23,15 +23,15 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
#endif #endif
namespace ModernKeePassLibPCL.Collections namespace ModernKeePassLib.Collections
{ {
/// <summary> /// <summary>
/// A list of <c>ProtectedString</c> objects (dictionary). /// A list of <c>ProtectedString</c> objects (dictionary).

View File

@@ -22,9 +22,9 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
namespace ModernKeePassLibPCL.Collections namespace ModernKeePassLib.Collections
{ {
/// <summary> /// <summary>
/// List of objects that implement <c>IDeepCloneable</c>, /// List of objects that implement <c>IDeepCloneable</c>,

View File

@@ -22,14 +22,14 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
#endif #endif
namespace ModernKeePassLibPCL.Collections namespace ModernKeePassLib.Collections
{ {
public sealed class PwObjectPool public sealed class PwObjectPool
{ {

View File

@@ -23,13 +23,13 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
#endif #endif
namespace ModernKeePassLibPCL.Collections namespace ModernKeePassLib.Collections
{ {
public sealed class StringDictionaryEx : IDeepCloneable<StringDictionaryEx>, public sealed class StringDictionaryEx : IDeepCloneable<StringDictionaryEx>,
IEnumerable<KeyValuePair<string, string>> IEnumerable<KeyValuePair<string, string>>

View File

@@ -24,7 +24,7 @@ using System.IO;
using System.Diagnostics; using System.Diagnostics;
using System.Security; using System.Security;
namespace ModernKeePassLibPCL.Cryptography.Cipher namespace ModernKeePassLib.Cryptography.Cipher
{ {
/// <summary> /// <summary>
/// Pool of encryption/decryption algorithms (ciphers). /// Pool of encryption/decryption algorithms (ciphers).

View File

@@ -20,7 +20,7 @@
using System; using System;
using System.IO; using System.IO;
namespace ModernKeePassLibPCL.Cryptography.Cipher namespace ModernKeePassLib.Cryptography.Cipher
{ {
/// <summary> /// <summary>
/// Interface of an encryption/decryption class. /// Interface of an encryption/decryption class.

View File

@@ -22,9 +22,9 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Cryptography.Cipher namespace ModernKeePassLib.Cryptography.Cipher
{ {
public sealed class Salsa20Cipher : IDisposable public sealed class Salsa20Cipher : IDisposable
{ {

View File

@@ -24,7 +24,7 @@ using System.IO;
using System.Security; using System.Security;
using System.Diagnostics; using System.Diagnostics;
using Windows.Storage.Streams; using Windows.Storage.Streams;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
#else #else
@@ -42,7 +42,7 @@ using Org.BouncyCastle.Crypto.Parameters;
#endif #endif
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.IO; using Org.BouncyCastle.Crypto.IO;
@@ -50,14 +50,14 @@ using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Paddings; using Org.BouncyCastle.Crypto.Paddings;
using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Parameters;
namespace ModernKeePassLibPCL.Cryptography.Cipher namespace ModernKeePassLib.Cryptography.Cipher
{ {
/// <summary> /// <summary>
/// Standard AES cipher implementation. /// Standard AES cipher implementation.
/// </summary> /// </summary>
public sealed class StandardAesEngine : ICipherEngine public sealed class StandardAesEngine : ICipherEngine
{ {
#if !ModernKeePassLibPCL && !KeePassRT #if !ModernKeePassLib && !KeePassRT
private const CipherMode m_rCipherMode = CipherMode.CBC; private const CipherMode m_rCipherMode = CipherMode.CBC;
private const PaddingMode m_rCipherPadding = PaddingMode.PKCS7; private const PaddingMode m_rCipherPadding = PaddingMode.PKCS7;
#endif #endif
@@ -129,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 !ModernKeePassLib
//#if ModernKeePassLibPCL //#if ModernKeePassLib
/*var provider = WinRTCrypto.SymmetricKeyAlgorithmProvider. /*var provider = WinRTCrypto.SymmetricKeyAlgorithmProvider.
OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7); OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7);
var key = provider.CreateSymmetricKey(pbLocalKey); var key = provider.CreateSymmetricKey(pbLocalKey);
@@ -173,7 +173,7 @@ namespace ModernKeePassLibPCL.Cryptography.Cipher
//#else //#else
//#if !KeePassRT //#if !KeePassRT
//#if !ModernKeePassLibPCL //#if !ModernKeePassLib
RijndaelManaged r = new RijndaelManaged(); RijndaelManaged r = new RijndaelManaged();
if(r.BlockSize != 128) // AES block size if(r.BlockSize != 128) // AES block size
{ {

View File

@@ -19,7 +19,7 @@
using System; using System;
using System.Security; using System.Security;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
@@ -27,11 +27,11 @@ using System.Security.Cryptography;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Native; using ModernKeePassLib.Native;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
/// <summary> /// <summary>
/// Cryptographically strong random number generator. The returned values /// Cryptographically strong random number generator. The returned values
@@ -42,7 +42,7 @@ namespace ModernKeePassLibPCL.Cryptography
{ {
private byte[] m_pbEntropyPool = new byte[64]; private byte[] m_pbEntropyPool = new byte[64];
private uint m_uCounter; private uint m_uCounter;
#if ModernKeePassLibPCL #if ModernKeePassLib
//private IRandomNumberGenerator m_rng = NetFxCrypto.RandomNumberGenerator; //private IRandomNumberGenerator m_rng = NetFxCrypto.RandomNumberGenerator;
#else #else
private RNGCryptoServiceProvider m_rng = new RNGCryptoServiceProvider(); private RNGCryptoServiceProvider m_rng = new RNGCryptoServiceProvider();
@@ -107,7 +107,7 @@ namespace ModernKeePassLibPCL.Cryptography
byte[] pbNewData = pbEntropy; byte[] pbNewData = pbEntropy;
if(pbEntropy.Length >= 64) if(pbEntropy.Length >= 64)
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var shaNew = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha512); /*var shaNew = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha512);
pbNewData = shaNew.HashData(pbEntropy);*/ pbNewData = shaNew.HashData(pbEntropy);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -132,7 +132,7 @@ namespace ModernKeePassLibPCL.Cryptography
ms.Write(pbNewData, 0, pbNewData.Length); ms.Write(pbNewData, 0, pbNewData.Length);
byte[] pbFinal = ms.ToArray(); byte[] pbFinal = ms.ToArray();
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var shaPool = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha512); /*var shaPool = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha512);
m_pbEntropyPool = shaPool.HashData(pbFinal);*/ m_pbEntropyPool = shaPool.HashData(pbFinal);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -164,7 +164,7 @@ namespace ModernKeePassLibPCL.Cryptography
pb = TimeUtil.PackTime(DateTime.Now); pb = TimeUtil.PackTime(DateTime.Now);
ms.Write(pb, 0, pb.Length); ms.Write(pb, 0, pb.Length);
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
// In try-catch for systems without GUI; // In try-catch for systems without GUI;
// https://sourceforge.net/p/keepass/discussion/329221/thread/20335b73/ // https://sourceforge.net/p/keepass/discussion/329221/thread/20335b73/
try try
@@ -181,7 +181,7 @@ namespace ModernKeePassLibPCL.Cryptography
pb = MemUtil.UInt32ToBytes((uint)rWeak.Next()); pb = MemUtil.UInt32ToBytes((uint)rWeak.Next());
ms.Write(pb, 0, pb.Length); ms.Write(pb, 0, pb.Length);
#if ModernKeePassLibPCL #if ModernKeePassLib
pb = MemUtil.UInt32ToBytes((uint)Environment.ProcessorCount); pb = MemUtil.UInt32ToBytes((uint)Environment.ProcessorCount);
ms.Write(pb, 0, pb.Length); ms.Write(pb, 0, pb.Length);
@@ -192,7 +192,7 @@ namespace ModernKeePassLibPCL.Cryptography
ms.Write(pb, 0, pb.Length); ms.Write(pb, 0, pb.Length);
#endif #endif
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
Process p = null; Process p = null;
try try
{ {
@@ -287,7 +287,7 @@ namespace ModernKeePassLibPCL.Cryptography
m_uGeneratedBytesCount += 32; m_uGeneratedBytesCount += 32;
} }
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
return sha256.HashData(pbFinal);*/ return sha256.HashData(pbFinal);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -322,7 +322,7 @@ namespace ModernKeePassLibPCL.Cryptography
long lCopy = (long)((uRequestedBytes < 32) ? uRequestedBytes : 32); long lCopy = (long)((uRequestedBytes < 32) ? uRequestedBytes : 32);
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
Array.Copy(pbRandom256, 0, pbRes, lPos, lCopy); Array.Copy(pbRandom256, 0, pbRes, lPos, lCopy);
#else #else
Array.Copy(pbRandom256, 0, pbRes, (int)lPos, (int)lCopy); Array.Copy(pbRandom256, 0, pbRes, (int)lPos, (int)lCopy);

View File

@@ -20,15 +20,15 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
#endif #endif
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
/// <summary> /// <summary>
/// Algorithms supported by <c>CryptoRandomStream</c>. /// Algorithms supported by <c>CryptoRandomStream</c>.
@@ -116,7 +116,7 @@ namespace ModernKeePassLibPCL.Cryptography
} }
else if(genAlgorithm == CrsAlgorithm.Salsa20) else if(genAlgorithm == CrsAlgorithm.Salsa20)
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbKey32 = sha256.HashData(pbKey);*/ var pbKey32 = sha256.HashData(pbKey);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);

View File

@@ -6,7 +6,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
public static class CryptographicHashExtensions public static class CryptographicHashExtensions
{ {

View File

@@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto;
@@ -31,16 +31,16 @@ using System.Security.Cryptography;
#endif #endif
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.ComTypes;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Org.BouncyCastle.Crypto.Tls; using Org.BouncyCastle.Crypto.Tls;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
public sealed class HashingStreamEx : Stream public sealed class HashingStreamEx : Stream
{ {
private Stream m_sBaseStream; private Stream m_sBaseStream;
private bool m_bWriting; private bool m_bWriting;
#if ModernKeePassLibPCL #if ModernKeePassLib
//private ICryptoTransform m_hash; //private ICryptoTransform m_hash;
//private CryptographicHash m_hash; //private CryptographicHash m_hash;
private IDigest m_hash; private IDigest m_hash;
@@ -81,7 +81,7 @@ namespace ModernKeePassLibPCL.Cryptography
set { throw new NotSupportedException(); } set { throw new NotSupportedException(); }
} }
#if ModernKeePassLibPCL #if ModernKeePassLib
//public HashingStreamEx(Stream sBaseStream, bool bWriting, HashAlgorithm? hashAlgorithm) //public HashingStreamEx(Stream sBaseStream, bool bWriting, HashAlgorithm? hashAlgorithm)
public HashingStreamEx(Stream sBaseStream, bool bWriting, string hashAlgorithm) public HashingStreamEx(Stream sBaseStream, bool bWriting, string hashAlgorithm)
#else #else
@@ -93,7 +93,7 @@ namespace ModernKeePassLibPCL.Cryptography
m_sBaseStream = sBaseStream; m_sBaseStream = sBaseStream;
m_bWriting = bWriting; m_bWriting = bWriting;
#if ModernKeePassLibPCL #if ModernKeePassLib
//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(); m_hash = new Sha256Digest();
@@ -125,7 +125,7 @@ namespace ModernKeePassLibPCL.Cryptography
m_sBaseStream.Flush(); m_sBaseStream.Flush();
} }
#if ModernKeePassLibPCL || KeePassRT #if ModernKeePassLib || KeePassRT
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if(!disposing) return; if(!disposing) return;
@@ -138,7 +138,7 @@ namespace ModernKeePassLibPCL.Cryptography
try try
{ {
//m_hash.TransformFinalBlock(new byte[0], 0, 0); //m_hash.TransformFinalBlock(new byte[0], 0, 0);
#if ModernKeePassLibPCL #if ModernKeePassLib
//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_pbFinalHash = new byte[32];

View File

@@ -20,18 +20,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
#endif #endif
using System.Globalization; using System.Globalization;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
#if (!KeePassLibSD && !KeePassRT) #if (!KeePassLibSD && !KeePassRT)
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
/// <summary> /// <summary>
/// Generate HMAC-based one-time passwords as specified in RFC 4226. /// Generate HMAC-based one-time passwords as specified in RFC 4226.
@@ -47,7 +47,7 @@ namespace ModernKeePassLibPCL.Cryptography
byte[] pbText = MemUtil.UInt64ToBytes(uFactor); byte[] pbText = MemUtil.UInt64ToBytes(uFactor);
Array.Reverse(pbText); // Big-Endian Array.Reverse(pbText); // Big-Endian
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var hsha1 = WinRTCrypto.MacAlgorithmProvider.OpenAlgorithm(MacAlgorithm.HmacSha1).CreateHash(pbSecret); /*var hsha1 = WinRTCrypto.MacAlgorithmProvider.OpenAlgorithm(MacAlgorithm.HmacSha1).CreateHash(pbSecret);
hsha1.Append(pbText); hsha1.Append(pbText);
var pbHash = hsha1.GetValueAndReset();*/ var pbHash = hsha1.GetValueAndReset();*/

View File

@@ -22,10 +22,10 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
internal static class CharSetBasedGenerator internal static class CharSetBasedGenerator
{ {

View File

@@ -21,10 +21,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using ModernKeePassLibPCL; using ModernKeePassLib;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
public abstract class CustomPwGenerator public abstract class CustomPwGenerator
{ {

View File

@@ -22,7 +22,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
public sealed class CustomPwGeneratorPool : IEnumerable<CustomPwGenerator> public sealed class CustomPwGeneratorPool : IEnumerable<CustomPwGenerator>
{ {

View File

@@ -22,10 +22,10 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
internal static class PatternBasedGenerator internal static class PatternBasedGenerator
{ {

View File

@@ -22,7 +22,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
public sealed class PwCharSet public sealed class PwCharSet
{ {

View File

@@ -22,9 +22,9 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
public enum PwgError public enum PwgError
{ {

View File

@@ -24,11 +24,11 @@ using System.Xml.Serialization;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Cryptography.PasswordGenerator namespace ModernKeePassLib.Cryptography.PasswordGenerator
{ {
/// <summary> /// <summary>
/// Type of the password generator. Different types like generators /// Type of the password generator. Different types like generators

View File

@@ -22,9 +22,9 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
public static class PopularPasswords public static class PopularPasswords
{ {

View File

@@ -22,10 +22,10 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Cryptography.PasswordGenerator; using ModernKeePassLib.Cryptography.PasswordGenerator;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
/// <summary> /// <summary>
/// A class that offers static functions to estimate the quality of /// A class that offers static functions to estimate the quality of

View File

@@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Security; using System.Security;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
@@ -29,14 +29,14 @@ using System.Text;
using System.Globalization; using System.Globalization;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLibPCL.Native; using ModernKeePassLib.Native;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
namespace ModernKeePassLibPCL.Cryptography namespace ModernKeePassLib.Cryptography
{ {
/* /// <summary> /* /// <summary>
/// Return values of the <c>SelfTest.Perform</c> method. /// Return values of the <c>SelfTest.Perform</c> method.
@@ -64,7 +64,7 @@ namespace ModernKeePassLibPCL.Cryptography
TestRijndael(); TestRijndael();
TestSalsa20(); TestSalsa20();
#if !ModernKeePassLibPCL #if !ModernKeePassLib
TestNativeKeyTransform(); TestNativeKeyTransform();
#endif #endif
@@ -82,7 +82,7 @@ namespace ModernKeePassLibPCL.Cryptography
internal static void TestFipsComplianceProblems() internal static void TestFipsComplianceProblems()
{ {
#if !ModernKeePassLibPCL && !KeePassRT #if !ModernKeePassLib && !KeePassRT
try { new RijndaelManaged(); } try { new RijndaelManaged(); }
catch(Exception exAes) catch(Exception exAes)
{ {
@@ -99,7 +99,7 @@ namespace ModernKeePassLibPCL.Cryptography
private static void TestRijndael() private static void TestRijndael()
{ {
#if !ModernKeePassLibPCL && !KeePassRT #if !ModernKeePassLib && !KeePassRT
// Test vector (official ECB test vector #356) // Test vector (official ECB test vector #356)
byte[] pbIV = new byte[16]; byte[] pbIV = new byte[16];
byte[] pbTestKey = new byte[32]; byte[] pbTestKey = new byte[32];
@@ -211,7 +211,7 @@ namespace ModernKeePassLibPCL.Cryptography
} }
#endif #endif
#if !ModernKeePassLibPCL #if !ModernKeePassLib
private static void TestNativeKeyTransform() private static void TestNativeKeyTransform()
{ {
#if DEBUG #if DEBUG

View File

@@ -19,7 +19,7 @@
using System; using System;
namespace ModernKeePassLibPCL.Delegates namespace ModernKeePassLib.Delegates
{ {
/// <summary> /// <summary>
/// Function definition of a method that performs an action on a group. /// Function definition of a method that performs an action on a group.

View File

@@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace ModernKeePassLibPCL.Interfaces namespace ModernKeePassLib.Interfaces
{ {
/// <summary> /// <summary>
/// Interface for objects that are deeply cloneable. /// Interface for objects that are deeply cloneable.

View File

@@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace ModernKeePassLibPCL.Interfaces namespace ModernKeePassLib.Interfaces
{ {
/// <summary> /// <summary>
/// Status message types. /// Status message types.

View File

@@ -19,7 +19,7 @@
using System; using System;
namespace ModernKeePassLibPCL.Interfaces namespace ModernKeePassLib.Interfaces
{ {
public interface IStructureItem : ITimeLogger // Provides LocationChanged public interface IStructureItem : ITimeLogger // Provides LocationChanged
{ {

View File

@@ -19,7 +19,7 @@
using System; using System;
namespace ModernKeePassLibPCL.Interfaces namespace ModernKeePassLib.Interfaces
{ {
/// <summary> /// <summary>
/// Interface for objects that support various times (creation time, last /// Interface for objects that support various times (creation time, last

View File

@@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace ModernKeePassLibPCL.Interfaces namespace ModernKeePassLib.Interfaces
{ {
public interface IUIOperations public interface IUIOperations
{ {

View File

@@ -23,7 +23,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
namespace ModernKeePassLibPCL.Interfaces namespace ModernKeePassLib.Interfaces
{ {
public interface IXmlSerializerEx public interface IXmlSerializerEx
{ {

View File

@@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices.WindowsRuntime; using System.Runtime.InteropServices.WindowsRuntime;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
@@ -34,16 +34,16 @@ using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Parameters;
#endif #endif
using ModernKeePassLibPCL.Native; using ModernKeePassLib.Native;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams; using Windows.Storage.Streams;
using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Parameters;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
/// <summary> /// <summary>
/// Represents a key. A key can be build up using several user key data sources /// Represents a key. A key can be build up using several user key data sources
@@ -117,7 +117,7 @@ namespace ModernKeePassLibPCL.Keys
return m_vUserKeys.Remove(pKey); return m_vUserKeys.Remove(pKey);
} }
#if !ModernKeePassLibPCL && !KeePassRT #if !ModernKeePassLib && !KeePassRT
/// <summary> /// <summary>
/// Test whether the composite key contains a specific type of /// Test whether the composite key contains a specific type of
/// user keys (password, key file, ...). If at least one user /// user keys (password, key file, ...). If at least one user
@@ -182,7 +182,7 @@ namespace ModernKeePassLibPCL.Keys
} }
} }
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbHash = sha256.HashData(ms.ToArray());*/ var pbHash = sha256.HashData(ms.ToArray());*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -243,7 +243,7 @@ namespace ModernKeePassLibPCL.Keys
private void ValidateUserKeys() private void ValidateUserKeys()
{ {
#if !ModernKeePassLibPCL #if !ModernKeePassLib
int nAccounts = 0; int nAccounts = 0;
foreach(IUserKey uKey in m_vUserKeys) foreach(IUserKey uKey in m_vUserKeys)
@@ -283,7 +283,7 @@ namespace ModernKeePassLibPCL.Keys
byte[] pbNewKey = new byte[32]; byte[] pbNewKey = new byte[32];
Array.Copy(pbOriginalKey32, pbNewKey, pbNewKey.Length); Array.Copy(pbOriginalKey32, pbNewKey, pbNewKey.Length);
#if !ModernKeePassLibPCL #if !ModernKeePassLib
// Try to use the native library first // Try to use the native library first
if(NativeLib.TransformKey256(pbNewKey, pbKeySeed32, uNumRounds)) if(NativeLib.TransformKey256(pbNewKey, pbKeySeed32, uNumRounds))
return (new SHA256Managed()).ComputeHash(pbNewKey); return (new SHA256Managed()).ComputeHash(pbNewKey);
@@ -292,7 +292,7 @@ namespace ModernKeePassLibPCL.Keys
if(TransformKeyManaged(ref pbNewKey, pbKeySeed32, uNumRounds) == false) if(TransformKeyManaged(ref pbNewKey, pbKeySeed32, uNumRounds) == false)
return null; return null;
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
return sha256.HashData(pbNewKey);*/ return sha256.HashData(pbNewKey);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -320,7 +320,7 @@ namespace ModernKeePassLibPCL.Keys
aes.ProcessBlock(pbNewKey32, 16, pbNewKey32, 16); aes.ProcessBlock(pbNewKey32, 16, pbNewKey32, 16);
} }
#else #else
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var aes = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesEcb); /*var aes = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesEcb);
var key = aes.CreateSymmetricKey(pbKeySeed32); var key = aes.CreateSymmetricKey(pbKeySeed32);
var iCrypt = WinRTCrypto.CryptographicEngine.CreateEncryptor(key);*/ var iCrypt = WinRTCrypto.CryptographicEngine.CreateEncryptor(key);*/
@@ -393,7 +393,7 @@ namespace ModernKeePassLibPCL.Keys
{ {
ulong uRounds; ulong uRounds;
#if !ModernKeePassLibPCL #if !ModernKeePassLib
// Try native method // Try native method
if(NativeLib.TransformKeyBenchmark256(uMilliseconds, out uRounds)) if(NativeLib.TransformKeyBenchmark256(uMilliseconds, out uRounds))
return uRounds; return uRounds;
@@ -412,7 +412,7 @@ namespace ModernKeePassLibPCL.Keys
AesEngine aes = new AesEngine(); AesEngine aes = new AesEngine();
aes.Init(true, kp); aes.Init(true, kp);
#else #else
#if ModernKeePassLibPCL #if ModernKeePassLib
var aes = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesEcb); var aes = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesEcb);
var key = aes.CreateSymmetricKey(pbKey); var key = aes.CreateSymmetricKey(pbKey);
var iCrypt = WinRTCrypto.CryptographicEngine.CreateEncryptor(key); var iCrypt = WinRTCrypto.CryptographicEngine.CreateEncryptor(key);

View File

@@ -19,9 +19,9 @@
using System; using System;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
/// <summary> /// <summary>
/// Interface to a user key, like a password, key file data, etc. /// Interface to a user key, like a password, key file data, etc.

View File

@@ -21,17 +21,17 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
#endif #endif
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
public sealed class KcpCustomKey : IUserKey public sealed class KcpCustomKey : IUserKey
{ {
@@ -60,7 +60,7 @@ namespace ModernKeePassLibPCL.Keys
if(bPerformHash) if(bPerformHash)
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbRaw = sha256.HashData(pbKeyData);*/ var pbRaw = sha256.HashData(pbKeyData);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);

View File

@@ -22,7 +22,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Security; using System.Security;
#if ModernKeePassLibPCL #if ModernKeePassLib
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
@@ -32,14 +32,14 @@ using System.Security.Cryptography;
#endif #endif
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
/// <summary> /// <summary>
/// Key files as provided by the user. /// Key files as provided by the user.
@@ -139,7 +139,7 @@ namespace ModernKeePassLibPCL.Keys
if(pbKey == null) if(pbKey == null)
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
pbKey = sha256.HashData(pbFileData);*/ pbKey = sha256.HashData(pbFileData);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -206,7 +206,7 @@ namespace ModernKeePassLibPCL.Keys
ms.Write(pbAdditionalEntropy, 0, pbAdditionalEntropy.Length); ms.Write(pbAdditionalEntropy, 0, pbAdditionalEntropy.Length);
ms.Write(pbKey32, 0, 32); ms.Write(pbKey32, 0, 32);
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
pbFinalKey32 = sha256.HashData(ms.ToArray());*/ pbFinalKey32 = sha256.HashData(ms.ToArray());*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -252,7 +252,7 @@ namespace ModernKeePassLibPCL.Keys
try try
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
var doc = XDocument.Load(ms); var doc = XDocument.Load(ms);
@@ -320,7 +320,7 @@ namespace ModernKeePassLibPCL.Keys
IOConnectionInfo ioc = IOConnectionInfo.FromPath(strFile); IOConnectionInfo ioc = IOConnectionInfo.FromPath(strFile);
var sOut = IOConnection.OpenWrite(ioc); var sOut = IOConnection.OpenWrite(ioc);
#if ModernKeePassLibPCL #if ModernKeePassLib
var settings = new XmlWriterSettings() { Encoding = StrUtil.Utf8 }; var settings = new XmlWriterSettings() { Encoding = StrUtil.Utf8 };
var xtw = XmlWriter.Create(sOut, settings); var xtw = XmlWriter.Create(sOut, settings);
#else #else

View File

@@ -20,17 +20,17 @@
using System; using System;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
#endif #endif
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
/// <summary> /// <summary>
/// Master password / passphrase as provided by the user. /// Master password / passphrase as provided by the user.
@@ -73,7 +73,7 @@ namespace ModernKeePassLibPCL.Keys
Debug.Assert(pbPasswordUtf8 != null); Debug.Assert(pbPasswordUtf8 != null);
if(pbPasswordUtf8 == null) throw new ArgumentNullException("pbPasswordUtf8"); if(pbPasswordUtf8 == null) throw new ArgumentNullException("pbPasswordUtf8");
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbRaw = sha256.HashData(pbPasswordUtf8);*/ var pbRaw = sha256.HashData(pbPasswordUtf8);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);

View File

@@ -22,12 +22,12 @@ using System.Security;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.IO; using System.IO;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
/// <summary> /// <summary>
/// A user key depending on the currently logged on Windows user account. /// A user key depending on the currently logged on Windows user account.

View File

@@ -21,9 +21,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
public sealed class KeyProviderQueryContext public sealed class KeyProviderQueryContext
{ {

View File

@@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
public sealed class KeyProviderPool : IEnumerable<KeyProvider> public sealed class KeyProviderPool : IEnumerable<KeyProvider>
{ {

View File

@@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
public enum KeyValidationType public enum KeyValidationType
{ {

View File

@@ -23,9 +23,9 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
public sealed class KeyValidatorPool : IEnumerable<KeyValidator> public sealed class KeyValidatorPool : IEnumerable<KeyValidator>
{ {

View File

@@ -19,7 +19,7 @@
using System; using System;
namespace ModernKeePassLibPCL.Keys namespace ModernKeePassLib.Keys
{ {
[Flags] [Flags]
public enum UserKeyType public enum UserKeyType

View File

@@ -7,8 +7,8 @@
<ProjectGuid>{2E710089-9559-4967-846C-E763DD1F3ACB}</ProjectGuid> <ProjectGuid>{2E710089-9559-4967-846C-E763DD1F3ACB}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ModernKeePassLibPCL</RootNamespace> <RootNamespace>ModernKeePassLib</RootNamespace>
<AssemblyName>ModernKeePassLibPCL</AssemblyName> <AssemblyName>ModernKeePassLib</AssemblyName>
<SignAssembly>false</SignAssembly> <SignAssembly>false</SignAssembly>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
@@ -28,7 +28,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath> <OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;ModernKeePassLibPCL</DefineConstants> <DefineConstants>DEBUG;ModernKeePassLib</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
@@ -37,7 +37,7 @@
<OutputPath>bin\Release</OutputPath> <OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DefineConstants>ModernKeePassLibPCL</DefineConstants> <DefineConstants>ModernKeePassLib</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Collections\AutoTypeConfig.cs" /> <Compile Include="Collections\AutoTypeConfig.cs" />
@@ -120,7 +120,7 @@
<None Include="app.config" /> <None Include="app.config" />
<None Include="KeePassLib.pfx" /> <None Include="KeePassLib.pfx" />
<None Include="Libs\Windows.winmd" /> <None Include="Libs\Windows.winmd" />
<None Include="ModernKeePassLibPCL.nuspec" /> <None Include="ModernKeePassLib.nuspec" />
<None Include="project.json" /> <None Include="project.json" />
<None Include="Utility\MessageService.cs" /> <None Include="Utility\MessageService.cs" />
<None Include="Native\NativeLib.cs" /> <None Include="Native\NativeLib.cs" />

View File

@@ -0,0 +1,9 @@
<?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)\NETStandard.Library\2.0.0\build\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)\NETStandard.Library\2.0.0\build\NETStandard.Library.targets')" />
</ImportGroup>
</Project>

View File

@@ -1,27 +1,30 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<package > <package >
<metadata> <metadata>
<id>ModernKeePassLibPCL</id> <id>ModernKeePassLib</id>
<version>2.28.1000</version> <version>2.28.2000</version>
<title>ModernKeePassLibPCL</title> <title>ModernKeePassLib</title>
<authors>Geoffroy Bonneville</authors> <authors>Geoffroy Bonneville</authors>
<owners>Geoffroy Bonneville</owners> <owners>Geoffroy Bonneville</owners>
<licenseUrl>https://www.gnu.org/licenses/gpl-3.0.en.html</licenseUrl> <licenseUrl>https://www.gnu.org/licenses/gpl-3.0.en.html</licenseUrl>
<projectUrl>https://github.com/wismna/ModernKeePass</projectUrl> <projectUrl>https://github.com/wismna/ModernKeePass</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Portable KeePass Password Management Library</description> <description>Portable KeePass Password Management Library that targets .Net Standard and WinRT</description>
<releaseNotes>Initial release.</releaseNotes> <releaseNotes>Bump to 2.28, write mode activated with BouncyCastle</releaseNotes>
<copyright>Copyright © 2017 Geoffroy Bonneville</copyright> <copyright>Copyright © 2017 Geoffroy Bonneville</copyright>
<tags>KeePass KeePassLib Portable</tags> <tags>KeePass KeePassLib Portable PCL</tags>
<!--<dependencies> <dependencies>
<group targetFramework=".NETStandard1.2"> <group targetFramework=".NETStandard1.2">
<dependency id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" exclude="Build,Analyzers" /> <dependency id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" exclude="Build,Analyzers" />
<dependency id="NETStandard.Library" version="2.0.0" exclude="Build,Analyzers" /> <dependency id="NETStandard.Library" version="2.0.0" exclude="Build,Analyzers" />
<dependency id="Portable.BouncyCastle" version="1.8.1.3" exclude="Build,Analyzers" />
<dependency id="Splat" version="2.0.0" exclude="Build,Analyzers" />
<dependency id="System.Net.Requests" version="4.3.0" exclude="Build,Analyzers" /> <dependency id="System.Net.Requests" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Runtime.WindowsRuntime" version="4.3.0" exclude="Build,Analyzers" /> <dependency id="System.Runtime.WindowsRuntime" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Xml.XmlSerializer" version="4.3.0" exclude="Build,Analyzers" /> <dependency id="System.Xml.XmlSerializer" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="Validation" version="4.3.0" exclude="2.4.15" />
</group> </group>
</dependencies>--> </dependencies>
</metadata> </metadata>
<!-- DLLs and resources --> <!-- DLLs and resources -->
<files> <files>

View File

@@ -0,0 +1,9 @@
<?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)\NETStandard.Library\2.0.0\build\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)\NETStandard.Library\2.0.0\build\NETStandard.Library.targets')" />
</ImportGroup>
</Project>

View File

@@ -2,7 +2,7 @@
using PlatformID = System.UInt32; using PlatformID = System.UInt32;
namespace ModernKeePassLibPCL.Native namespace ModernKeePassLib.Native
{ {
internal static class NativeLib internal static class NativeLib
{ {

View File

@@ -28,9 +28,9 @@ using System.IO;
using System.Reflection; using System.Reflection;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Native namespace ModernKeePassLib.Native
{ {
/// <summary> /// <summary>
/// Interface to native library (library containing fast versions of /// Interface to native library (library containing fast versions of

View File

@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
using System.Reflection; using System.Reflection;
using System.Diagnostics; using System.Diagnostics;
namespace ModernKeePassLibPCL.Native namespace ModernKeePassLib.Native
{ {
internal static partial class NativeMethods internal static partial class NativeMethods
{ {

View File

@@ -24,9 +24,9 @@ using System.Runtime.InteropServices;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Native namespace ModernKeePassLib.Native
{ {
internal static partial class NativeMethods internal static partial class NativeMethods
{ {

View File

@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
// COM settings // COM settings
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
#if !ModernKeePassLibPCL #if !ModernKeePassLib
// Assembly GUID // Assembly GUID
[assembly: Guid("395f6eec-a1e0-4438-aa82-b75099348134")] [assembly: Guid("395f6eec-a1e0-4438-aa82-b75099348134")]
#endif #endif

View File

@@ -19,16 +19,16 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Image = Splat.IBitmap; using Image = Splat.IBitmap;
#else #else
using System.Drawing; using System.Drawing;
#endif #endif
using System.IO; using System.IO;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// Custom icon. <c>PwCustomIcon</c> objects are immutable. /// Custom icon. <c>PwCustomIcon</c> objects are immutable.

View File

@@ -23,22 +23,22 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Image = Splat.IBitmap; using Image = Splat.IBitmap;
#endif #endif
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLibPCL.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// The core password manager class. It contains a number of groups, which /// The core password manager class. It contains a number of groups, which

View File

@@ -23,11 +23,11 @@ using System.Xml.Serialization;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Serialization; using ModernKeePassLib.Serialization;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// Contains KeePassLib-global definitions and enums. /// Contains KeePassLib-global definitions and enums.
@@ -318,7 +318,7 @@ namespace ModernKeePassLibPCL
set { m_bSearchInTags = value; } set { m_bSearchInTags = value; }
} }
#if ModernKeePassLibPCL || KeePassRT #if ModernKeePassLib || KeePassRT
private StringComparison m_scType = StringComparison.OrdinalIgnoreCase; private StringComparison m_scType = StringComparison.OrdinalIgnoreCase;
#else #else
private StringComparison m_scType = StringComparison.InvariantCultureIgnoreCase; private StringComparison m_scType = StringComparison.InvariantCultureIgnoreCase;

View File

@@ -21,9 +21,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// Represents an object that has been deleted. /// Represents an object that has been deleted.

View File

@@ -23,12 +23,12 @@ using System.Diagnostics;
using System.Xml; using System.Xml;
using System.Drawing; using System.Drawing;
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// A class representing a password entry. A password entry consists of several /// A class representing a password entry. A password entry consists of several
@@ -889,7 +889,7 @@ namespace ModernKeePassLibPCL
if(m_bCompareNaturally) return StrUtil.CompareNaturally(strA, strB); if(m_bCompareNaturally) return StrUtil.CompareNaturally(strA, strB);
#if ModernKeePassLibPCL || KeePassRT #if ModernKeePassLib || KeePassRT
return string.Compare(strA, strB, m_bCaseInsensitive ? return string.Compare(strA, strB, m_bCaseInsensitive ?
StringComparison.CurrentCultureIgnoreCase : StringComparison.CurrentCulture); StringComparison.CurrentCultureIgnoreCase : StringComparison.CurrentCulture);
#else #else

View File

@@ -19,7 +19,7 @@
using System; using System;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// Compression algorithm specifiers. /// Compression algorithm specifiers.

View File

@@ -22,13 +22,13 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLibPCL.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
/// <summary> /// <summary>
/// A group containing several password entries. /// A group containing several password entries.
@@ -841,13 +841,13 @@ namespace ModernKeePassLibPCL
Regex rx = null; Regex rx = null;
if(sp.RegularExpression) if(sp.RegularExpression)
{ {
#if ModernKeePassLibPCL || KeePassRT #if ModernKeePassLib || KeePassRT
RegexOptions ro = RegexOptions.None; RegexOptions ro = RegexOptions.None;
#else #else
RegexOptions ro = RegexOptions.Compiled; RegexOptions ro = RegexOptions.Compiled;
#endif #endif
if((sp.ComparisonMode == StringComparison.CurrentCultureIgnoreCase) || if((sp.ComparisonMode == StringComparison.CurrentCultureIgnoreCase) ||
#if !ModernKeePassLibPCL && !KeePassRT #if !ModernKeePassLib && !KeePassRT
(sp.ComparisonMode == StringComparison.InvariantCultureIgnoreCase) || (sp.ComparisonMode == StringComparison.InvariantCultureIgnoreCase) ||
#endif #endif
(sp.ComparisonMode == StringComparison.OrdinalIgnoreCase)) (sp.ComparisonMode == StringComparison.OrdinalIgnoreCase))

View File

@@ -22,9 +22,9 @@ using System.Collections.Generic;
using System.Xml; using System.Xml;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL namespace ModernKeePassLib
{ {
// [ImmutableObject(true)] // [ImmutableObject(true)]
/// <summary> /// <summary>

View File

@@ -4,7 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace ModernKeePassLibPCL.Resources namespace ModernKeePassLib.Resources
{ {
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.

View File

@@ -4,7 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace ModernKeePassLibPCL.Resources namespace ModernKeePassLib.Resources
{ {
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.

View File

@@ -21,16 +21,16 @@ using System;
using System.Threading; using System.Threading;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLibPCL.Native; using ModernKeePassLib.Native;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
#endif #endif
namespace ModernKeePassLibPCL.Security namespace ModernKeePassLib.Security
{ {
[Flags] [Flags]
public enum PbCryptFlags public enum PbCryptFlags

View File

@@ -21,8 +21,8 @@ using System;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
@@ -30,7 +30,7 @@ using KeePassLibSD;
// SecureString objects are limited to 65536 characters, don't use // SecureString objects are limited to 65536 characters, don't use
namespace ModernKeePassLibPCL.Security namespace ModernKeePassLib.Security
{ {
/// <summary> /// <summary>
/// Represents an in-memory encrypted string. /// Represents an in-memory encrypted string.

View File

@@ -20,7 +20,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace ModernKeePassLibPCL.Security namespace ModernKeePassLib.Security
{ {
/// <summary> /// <summary>
/// Represents an object that is encrypted using a XOR pad until /// Represents an object that is encrypted using a XOR pad until

View File

@@ -22,9 +22,9 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
public sealed class BinaryReaderEx public sealed class BinaryReaderEx
{ {

View File

@@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
#if ModernKeePassLibPCL #if ModernKeePassLib
using System.Threading.Tasks; using System.Threading.Tasks;
#else #else
using System.Threading; using System.Threading;
@@ -29,11 +29,11 @@ using System.Threading;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices.WindowsRuntime; using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Storage.Streams; using Windows.Storage.Streams;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
public sealed class FileLockException : Exception public sealed class FileLockException : Exception
{ {
@@ -233,7 +233,7 @@ namespace ModernKeePassLibPCL.Serialization
if(bFileDeleted) break; if(bFileDeleted) break;
#if ModernKeePassLibPCL #if ModernKeePassLib
if(bDisposing) if(bDisposing)
Task.Delay(50).Wait(); Task.Delay(50).Wait();
#else #else

View File

@@ -23,16 +23,16 @@ using System.Text;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
using System.Security.AccessControl; using System.Security.AccessControl;
#endif #endif
using ModernKeePassLibPCL.Native; using ModernKeePassLib.Native;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.Storage.Streams; using Windows.Storage.Streams;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
public sealed class FileTransactionEx public sealed class FileTransactionEx
{ {
@@ -61,8 +61,8 @@ namespace ModernKeePassLibPCL.Serialization
m_bTransacted = bTransacted; m_bTransacted = bTransacted;
m_iocBase = iocBaseFile.CloneDeep(); m_iocBase = iocBaseFile.CloneDeep();
// ModernKeePassLibPCL is currently targeting .NET 4.5 // ModernKeePassLib is currently targeting .NET 4.5
#if !ModernKeePassLibPCL #if !ModernKeePassLib
// Prevent transactions for FTP URLs under .NET 4.0 in order to // Prevent transactions for FTP URLs under .NET 4.0 in order to
// avoid/workaround .NET bug 621450: // avoid/workaround .NET bug 621450:
// https://connect.microsoft.com/VisualStudio/feedback/details/621450/problem-renaming-file-on-ftp-server-using-ftpwebrequest-in-net-framework-4-0-vs2010-only // https://connect.microsoft.com/VisualStudio/feedback/details/621450/problem-renaming-file-on-ftp-server-using-ftpwebrequest-in-net-framework-4-0-vs2010-only
@@ -104,14 +104,14 @@ namespace ModernKeePassLibPCL.Serialization
{ {
bool bMadeUnhidden = UrlUtil.UnhideFile(m_iocBase.Path); bool bMadeUnhidden = UrlUtil.UnhideFile(m_iocBase.Path);
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
FileSecurity bkSecurity = null; FileSecurity bkSecurity = null;
bool bEfsEncrypted = false; bool bEfsEncrypted = false;
#endif #endif
if(IOConnection.FileExists(m_iocBase)) if(IOConnection.FileExists(m_iocBase))
{ {
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
if(m_iocBase.IsLocalFile()) if(m_iocBase.IsLocalFile())
{ {
try try
@@ -133,7 +133,7 @@ namespace ModernKeePassLibPCL.Serialization
IOConnection.RenameFile(m_iocTemp, m_iocBase); IOConnection.RenameFile(m_iocTemp, m_iocBase);
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
if(m_iocBase.IsLocalFile()) if(m_iocBase.IsLocalFile())
{ {
try try

View File

@@ -19,7 +19,7 @@
using System; using System;
using System.IO; using System.IO;
#if ModernKeePassLibPCL #if ModernKeePassLib
using System.Linq; using System.Linq;
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
@@ -28,15 +28,15 @@ using System.Security.Cryptography;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using ModernKeePassLibPCL.Native; using ModernKeePassLib.Native;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
#if KeePassLibSD #if KeePassLibSD
using KeePassLibSD; using KeePassLibSD;
#endif #endif
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
public sealed class HashedBlockStream : Stream public sealed class HashedBlockStream : Stream
{ {
@@ -136,7 +136,7 @@ namespace ModernKeePassLibPCL.Serialization
if(m_bWriting) m_bwOutput.Flush(); if(m_bWriting) m_bwOutput.Flush();
} }
#if ModernKeePassLibPCL || KeePassRT #if ModernKeePassLib || KeePassRT
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if(!disposing) return; if(!disposing) return;
@@ -251,7 +251,7 @@ namespace ModernKeePassLibPCL.Serialization
if(m_bVerify) if(m_bVerify)
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbComputedHash = sha256.HashData(m_pbBuffer);*/ var pbComputedHash = sha256.HashData(m_pbBuffer);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -302,7 +302,7 @@ namespace ModernKeePassLibPCL.Serialization
if(m_nBufferPos > 0) if(m_nBufferPos > 0)
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbHash = sha256.HashData(m_pbBuffer.Where((x, i) => i < m_nBufferPos).ToArray());*/ var pbHash = sha256.HashData(m_pbBuffer.Where((x, i) => i < m_nBufferPos).ToArray());*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);

View File

@@ -24,24 +24,24 @@ using System.Net;
using System.Diagnostics; using System.Diagnostics;
using Windows.Storage.Streams; using Windows.Storage.Streams;
using System.Threading.Tasks; using System.Threading.Tasks;
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
using System.Net.Cache; using System.Net.Cache;
using System.Net.Security; using System.Net.Security;
#endif #endif
#if !ModernKeePassLibPCL && !KeePassRT #if !ModernKeePassLib && !KeePassRT
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
#endif #endif
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Storage; using Windows.Storage;
//using PCLStorage; //using PCLStorage;
#endif #endif
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
internal sealed class IOWebClient : WebClient internal sealed class IOWebClient : WebClient
{ {
protected override WebRequest GetWebRequest(Uri address) protected override WebRequest GetWebRequest(Uri address)
@@ -53,7 +53,7 @@ namespace ModernKeePassLibPCL.Serialization
} }
#endif #endif
#if !ModernKeePassLibPCL #if !ModernKeePassLib
internal abstract class WrapperStream : Stream internal abstract class WrapperStream : Stream
{ {
private readonly Stream m_s; private readonly Stream m_s;
@@ -226,7 +226,7 @@ namespace ModernKeePassLibPCL.Serialization
public static class IOConnection public static class IOConnection
{ {
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
private static ProxyServerType m_pstProxyType = ProxyServerType.System; private static ProxyServerType m_pstProxyType = ProxyServerType.System;
private static string m_strProxyAddr = string.Empty; private static string m_strProxyAddr = string.Empty;
private static string m_strProxyPort = string.Empty; private static string m_strProxyPort = string.Empty;
@@ -250,7 +250,7 @@ namespace ModernKeePassLibPCL.Serialization
public static event EventHandler<IOAccessEventArgs> IOAccessPre; public static event EventHandler<IOAccessEventArgs> IOAccessPre;
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
// Allow self-signed certificates, expired certificates, etc. // Allow self-signed certificates, expired certificates, etc.
private static bool AcceptCertificate(object sender, private static bool AcceptCertificate(object sender,
X509Certificate certificate, X509Chain chain, X509Certificate certificate, X509Chain chain,
@@ -435,7 +435,7 @@ namespace ModernKeePassLibPCL.Serialization
return ioc.StorageFile.OpenAsync(FileAccessMode.Read).GetAwaiter().GetResult().AsStream(); return ioc.StorageFile.OpenAsync(FileAccessMode.Read).GetAwaiter().GetResult().AsStream();
} }
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
public static Stream OpenWrite(IOConnectionInfo ioc) public static Stream OpenWrite(IOConnectionInfo ioc)
{ {
if(ioc == null) { Debug.Assert(false); return null; } if(ioc == null) { Debug.Assert(false); return null; }
@@ -511,7 +511,7 @@ namespace ModernKeePassLibPCL.Serialization
iocFrom.StorageFile?.RenameAsync(iocTo.Path).GetAwaiter().GetResult(); iocFrom.StorageFile?.RenameAsync(iocTo.Path).GetAwaiter().GetResult();
} }
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT) #if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
private static bool SendCommand(IOConnectionInfo ioc, string strMethod) private static bool SendCommand(IOConnectionInfo ioc, string strMethod)
{ {
try try
@@ -525,7 +525,7 @@ namespace ModernKeePassLibPCL.Serialization
return true; return true;
} }
#endif #endif
#if !ModernKeePassLibPCL #if !ModernKeePassLib
internal static void DisposeResponse(WebResponse wr, bool bGetStream) internal static void DisposeResponse(WebResponse wr, bool bGetStream)
{ {
if(wr == null) return; if(wr == null) return;

View File

@@ -25,16 +25,16 @@ using System.Net;
using System.ComponentModel; using System.ComponentModel;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Diagnostics; using System.Diagnostics;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Storage; using Windows.Storage;
//using PCLStorage; //using PCLStorage;
#endif #endif
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
public enum IOCredSaveMode public enum IOCredSaveMode
{ {
@@ -309,7 +309,7 @@ namespace ModernKeePassLibPCL.Serialization
public async Task<bool> CanProbablyAccess() public async Task<bool> CanProbablyAccess()
{ {
#if ModernKeePassLibPCL #if ModernKeePassLib
if (IsLocalFile()) if (IsLocalFile())
{ {
//return (FileSystem.Current.GetFileFromPathAsync(m_strUrl).Result != null); //return (FileSystem.Current.GetFileFromPathAsync(m_strUrl).Result != null);

View File

@@ -26,16 +26,16 @@ using System.Xml;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
using ModernKeePassLibPCL; using ModernKeePassLib;
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
/// <summary> /// <summary>
/// Serialization to KeePass KDBX files. /// Serialization to KeePass KDBX files.
@@ -99,7 +99,7 @@ namespace ModernKeePassLibPCL.Serialization
xrs.IgnoreProcessingInstructions = true; xrs.IgnoreProcessingInstructions = true;
xrs.IgnoreWhitespace = true; xrs.IgnoreWhitespace = true;
#if !ModernKeePassLibPCL #if !ModernKeePassLib
// these are default values, so no need to set them // these are default values, so no need to set them
#if !KeePassRT #if !KeePassRT
#if !KeePassLibSD #if !KeePassLibSD
@@ -690,7 +690,7 @@ namespace ModernKeePassLibPCL.Serialization
} }
m_bReadNextNode = false; // ReadElementString skips end tag m_bReadNextNode = false; // ReadElementString skips end tag
#if ModernKeePassLibPCL #if ModernKeePassLib
return xr.ReadElementContentAsString(); return xr.ReadElementContentAsString();
#else #else
return xr.ReadElementString(); return xr.ReadElementString();
@@ -700,7 +700,7 @@ namespace ModernKeePassLibPCL.Serialization
private string ReadStringRaw(XmlReader xr) private string ReadStringRaw(XmlReader xr)
{ {
m_bReadNextNode = false; // ReadElementString skips end tag m_bReadNextNode = false; // ReadElementString skips end tag
#if ModernKeePassLibPCL #if ModernKeePassLib
return xr.ReadElementContentAsString(); return xr.ReadElementContentAsString();
#else #else
return xr.ReadElementString(); return xr.ReadElementString();

View File

@@ -23,7 +23,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
using System.Security; using System.Security;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
@@ -36,16 +36,16 @@ using System.IO.Compression;
using KeePassLibSD; using KeePassLibSD;
#endif #endif
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams; using Windows.Storage.Streams;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
/// <summary> /// <summary>
/// Serialization to KeePass KDBX files. /// Serialization to KeePass KDBX files.
@@ -156,7 +156,7 @@ namespace ModernKeePassLibPCL.Serialization
// GC.KeepAlive(br); // GC.KeepAlive(br);
// GC.KeepAlive(brDecrypted); // GC.KeepAlive(brDecrypted);
} }
#if !ModernKeePassLibPCL #if !ModernKeePassLib
catch(CryptographicException) // Thrown on invalid padding catch(CryptographicException) // Thrown on invalid padding
{ {
throw new CryptographicException(KLRes.FileCorrupted); throw new CryptographicException(KLRes.FileCorrupted);
@@ -222,7 +222,7 @@ namespace ModernKeePassLibPCL.Serialization
byte[] pbHeader = msHeader.ToArray(); byte[] pbHeader = msHeader.ToArray();
msHeader.Dispose(); msHeader.Dispose();
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
m_pbHashOfHeader = sha256.HashData(pbHeader);*/ m_pbHashOfHeader = sha256.HashData(pbHeader);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -352,7 +352,7 @@ namespace ModernKeePassLibPCL.Serialization
throw new SecurityException(KLRes.InvalidCompositeKey); throw new SecurityException(KLRes.InvalidCompositeKey);
ms.Write(pKey32, 0, 32); ms.Write(pKey32, 0, 32);
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var aesKey = sha256.HashData(ms.ToArray());*/ var aesKey = sha256.HashData(ms.ToArray());*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);

View File

@@ -23,7 +23,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Security; using System.Security;
#if ModernKeePassLibPCL #if ModernKeePassLib
using Windows.Security.Cryptography; using Windows.Security.Cryptography;
#else #else
using System.Security.Cryptography; using System.Security.Cryptography;
@@ -38,19 +38,19 @@ using System.IO.Compression;
using KeePassLibSD; using KeePassLibSD;
#endif #endif
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Cryptography.Cipher; using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLibPCL.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Keys; using ModernKeePassLib.Keys;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams; using Windows.Storage.Streams;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
/// <summary> /// <summary>
/// Serialization to KeePass KDBX files. /// Serialization to KeePass KDBX files.
@@ -126,7 +126,7 @@ namespace ModernKeePassLibPCL.Serialization
writerStream = hashedStream; writerStream = hashedStream;
else { Debug.Assert(false); throw new FormatException("KdbFormat"); } else { Debug.Assert(false); throw new FormatException("KdbFormat"); }
#if ModernKeePassLibPCL #if ModernKeePassLib
var settings = new XmlWriterSettings() { var settings = new XmlWriterSettings() {
Encoding = encNoBom, Encoding = encNoBom,
Indent = true, Indent = true,
@@ -192,7 +192,7 @@ namespace ModernKeePassLibPCL.Serialization
byte[] pbHeader = ms.ToArray(); byte[] pbHeader = ms.ToArray();
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
m_pbHashOfHeader = sha256.HashData(pbHeader);*/ m_pbHashOfHeader = sha256.HashData(pbHeader);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -243,7 +243,7 @@ namespace ModernKeePassLibPCL.Serialization
throw new SecurityException(KLRes.InvalidCompositeKey); throw new SecurityException(KLRes.InvalidCompositeKey);
ms.Write(pKey32, 0, 32); ms.Write(pKey32, 0, 32);
#if ModernKeePassLibPCL #if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256); /*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var aesKey = sha256.HashData(ms.ToArray());*/ var aesKey = sha256.HashData(ms.ToArray());*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
@@ -275,7 +275,7 @@ namespace ModernKeePassLibPCL.Serialization
BinPoolBuild(pgRoot); BinPoolBuild(pgRoot);
#if !ModernKeePassLibPCL #if !ModernKeePassLib
m_xmlWriter.Formatting = Formatting.Indented; m_xmlWriter.Formatting = Formatting.Indented;
m_xmlWriter.IndentChar = '\t'; m_xmlWriter.IndentChar = '\t';
m_xmlWriter.Indentation = 1; m_xmlWriter.Indentation = 1;

View File

@@ -29,19 +29,19 @@ using System.Diagnostics;
using System.IO.Compression; using System.IO.Compression;
#endif #endif
#if ModernKeePassLibPCL #if ModernKeePassLib
//using PCLStorage; //using PCLStorage;
using Windows.Storage; using Windows.Storage;
#endif #endif
using ModernKeePassLibPCL.Collections; using ModernKeePassLib.Collections;
using ModernKeePassLibPCL.Cryptography; using ModernKeePassLib.Cryptography;
using ModernKeePassLibPCL.Delegates; using ModernKeePassLib.Delegates;
using ModernKeePassLibPCL.Interfaces; using ModernKeePassLib.Interfaces;
using ModernKeePassLibPCL.Security; using ModernKeePassLib.Security;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
/// <summary> /// <summary>
/// The <c>KdbxFile</c> class supports saving the data to various /// The <c>KdbxFile</c> class supports saving the data to various
@@ -196,7 +196,7 @@ namespace ModernKeePassLibPCL.Serialization
private PwDatabase m_pwDatabase; // Not null, see constructor private PwDatabase m_pwDatabase; // Not null, see constructor
#if ModernKeePassLibPCL #if ModernKeePassLib
private XmlWriter m_xmlWriter = null; private XmlWriter m_xmlWriter = null;
#else #else
private XmlTextWriter m_xmlWriter = null; private XmlTextWriter m_xmlWriter = null;
@@ -384,14 +384,14 @@ namespace ModernKeePassLibPCL.Serialization
++iTry; ++iTry;
} }
#if ModernKeePassLibPCL #if ModernKeePassLib
//while(FileSystem.Current.GetFileFromPathAsync(strPath).Result != null); //while(FileSystem.Current.GetFileFromPathAsync(strPath).Result != null);
while (StorageFile.GetFileFromPathAsync(strPath).GetResults() != null); while (StorageFile.GetFileFromPathAsync(strPath).GetResults() != null);
#else #else
while(File.Exists(strPath)); while(File.Exists(strPath));
#endif #endif
#if ModernKeePassLibPCL #if ModernKeePassLib
byte[] pbData = pb.ReadData(); byte[] pbData = pb.ReadData();
/*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result; /*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result;
using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/ using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/

View File

@@ -21,10 +21,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using ModernKeePassLibPCL.Resources; using ModernKeePassLib.Resources;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization namespace ModernKeePassLib.Serialization
{ {
public sealed class OldFormatException : Exception public sealed class OldFormatException : Exception
{ {

View File

@@ -29,9 +29,9 @@ using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Drawing; using System.Drawing;
using ModernKeePassLibPCL.Utility; using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Translation namespace ModernKeePassLib.Translation
{ {
public sealed class KpccLayout public sealed class KpccLayout
{ {

View File

@@ -25,7 +25,7 @@ using System.Xml.Serialization;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection; using System.Reflection;
namespace ModernKeePassLibPCL.Translation namespace ModernKeePassLib.Translation
{ {
public sealed class KPFormCustomization public sealed class KPFormCustomization
{ {

View File

@@ -24,7 +24,7 @@ using System.Xml.Serialization;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
namespace ModernKeePassLibPCL.Translation namespace ModernKeePassLib.Translation
{ {
public sealed class KPStringTable public sealed class KPStringTable
{ {

Some files were not shown because too many files have changed in this diff Show More