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

3
.gitignore vendored
View File

@@ -34,4 +34,5 @@ Translation/TrlUtil.vshost.exe.manifest
*.nupkg
.vs/
/UpgradeLog.htm
packages/
packages/
project.lock.json

View File

@@ -5,7 +5,7 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePass", "ModernKeePass\ModernKeePass.csproj", "{A0CFC681-769B-405A-8482-0CDEE595A91F}"
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
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernKeePassLib.Test", "ModernKeePassLib.Test\ModernKeePassLib.Test.csproj", "{067456C0-086C-46A8-B37F-1405717B7BFC}"
ProjectSection(ProjectDependencies) = postProject

View File

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

View File

@@ -159,30 +159,10 @@
</Page>
</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">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\win8\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
</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>

View File

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

View File

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

View File

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

View File

@@ -1,19 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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.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="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.Diagnostics.Debug" 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.Xml.ReaderWriter" 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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,9 +19,9 @@
using System;
using ModernKeePassLibPCL.Security;
using ModernKeePassLib.Security;
namespace ModernKeePassLibPCL.Keys
namespace ModernKeePassLib.Keys
{
/// <summary>
/// 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.Text;
using System.Diagnostics;
#if ModernKeePassLibPCL
#if ModernKeePassLib
using Windows.Security.Cryptography;
#else
using System.Security.Cryptography;
#endif
using ModernKeePassLibPCL.Security;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core;
namespace ModernKeePassLibPCL.Keys
namespace ModernKeePassLib.Keys
{
public sealed class KcpCustomKey : IUserKey
{
@@ -60,7 +60,7 @@ namespace ModernKeePassLibPCL.Keys
if(bPerformHash)
{
#if ModernKeePassLibPCL
#if ModernKeePassLib
/*var sha256 = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
var pbRaw = sha256.HashData(pbKeyData);*/
var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);

View File

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

View File

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

View File

@@ -22,12 +22,12 @@ using System.Security;
using System.Security.Cryptography;
using System.IO;
using ModernKeePassLibPCL.Cryptography;
using ModernKeePassLibPCL.Resources;
using ModernKeePassLibPCL.Security;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Resources;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Keys
namespace ModernKeePassLib.Keys
{
/// <summary>
/// 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.Text;
using ModernKeePassLibPCL.Serialization;
using ModernKeePassLib.Serialization;
namespace ModernKeePassLibPCL.Keys
namespace ModernKeePassLib.Keys
{
public sealed class KeyProviderQueryContext
{

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,8 +7,8 @@
<ProjectGuid>{2E710089-9559-4967-846C-E763DD1F3ACB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ModernKeePassLibPCL</RootNamespace>
<AssemblyName>ModernKeePassLibPCL</AssemblyName>
<RootNamespace>ModernKeePassLib</RootNamespace>
<AssemblyName>ModernKeePassLib</AssemblyName>
<SignAssembly>false</SignAssembly>
<FileUpgradeFlags>
</FileUpgradeFlags>
@@ -28,7 +28,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;ModernKeePassLibPCL</DefineConstants>
<DefineConstants>DEBUG;ModernKeePassLib</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -37,7 +37,7 @@
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DefineConstants>ModernKeePassLibPCL</DefineConstants>
<DefineConstants>ModernKeePassLib</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="Collections\AutoTypeConfig.cs" />
@@ -120,7 +120,7 @@
<None Include="app.config" />
<None Include="KeePassLib.pfx" />
<None Include="Libs\Windows.winmd" />
<None Include="ModernKeePassLibPCL.nuspec" />
<None Include="ModernKeePassLib.nuspec" />
<None Include="project.json" />
<None Include="Utility\MessageService.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"?>
<package >
<metadata>
<id>ModernKeePassLibPCL</id>
<version>2.28.1000</version>
<title>ModernKeePassLibPCL</title>
<id>ModernKeePassLib</id>
<version>2.28.2000</version>
<title>ModernKeePassLib</title>
<authors>Geoffroy Bonneville</authors>
<owners>Geoffroy Bonneville</owners>
<licenseUrl>https://www.gnu.org/licenses/gpl-3.0.en.html</licenseUrl>
<projectUrl>https://github.com/wismna/ModernKeePass</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Portable KeePass Password Management Library</description>
<releaseNotes>Initial release.</releaseNotes>
<description>Portable KeePass Password Management Library that targets .Net Standard and WinRT</description>
<releaseNotes>Bump to 2.28, write mode activated with BouncyCastle</releaseNotes>
<copyright>Copyright © 2017 Geoffroy Bonneville</copyright>
<tags>KeePass KeePassLib Portable</tags>
<!--<dependencies>
<tags>KeePass KeePassLib Portable PCL</tags>
<dependencies>
<group targetFramework=".NETStandard1.2">
<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="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.Runtime.WindowsRuntime" 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>
</dependencies>-->
</dependencies>
</metadata>
<!-- DLLs and resources -->
<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;
namespace ModernKeePassLibPCL.Native
namespace ModernKeePassLib.Native
{
internal static class NativeLib
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,22 +23,22 @@ using System.Diagnostics;
using System.IO;
using System.Drawing;
#if ModernKeePassLibPCL
#if ModernKeePassLib
using Image = Splat.IBitmap;
#endif
using ModernKeePassLibPCL.Collections;
using ModernKeePassLibPCL.Cryptography;
using ModernKeePassLibPCL.Cryptography.Cipher;
using ModernKeePassLibPCL.Delegates;
using ModernKeePassLibPCL.Interfaces;
using ModernKeePassLibPCL.Keys;
using ModernKeePassLibPCL.Resources;
using ModernKeePassLibPCL.Security;
using ModernKeePassLibPCL.Serialization;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLib.Delegates;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys;
using ModernKeePassLib.Resources;
using ModernKeePassLib.Security;
using ModernKeePassLib.Serialization;
using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL
namespace ModernKeePassLib
{
/// <summary>
/// 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.Diagnostics;
using ModernKeePassLibPCL.Delegates;
using ModernKeePassLibPCL.Interfaces;
using ModernKeePassLibPCL.Serialization;
using ModernKeePassLib.Delegates;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Serialization;
namespace ModernKeePassLibPCL
namespace ModernKeePassLib
{
/// <summary>
/// Contains KeePassLib-global definitions and enums.
@@ -318,7 +318,7 @@ namespace ModernKeePassLibPCL
set { m_bSearchInTags = value; }
}
#if ModernKeePassLibPCL || KeePassRT
#if ModernKeePassLib || KeePassRT
private StringComparison m_scType = StringComparison.OrdinalIgnoreCase;
#else
private StringComparison m_scType = StringComparison.InvariantCultureIgnoreCase;

View File

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

View File

@@ -23,12 +23,12 @@ using System.Diagnostics;
using System.Xml;
using System.Drawing;
using ModernKeePassLibPCL.Collections;
using ModernKeePassLibPCL.Interfaces;
using ModernKeePassLibPCL.Security;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL
namespace ModernKeePassLib
{
/// <summary>
/// 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 ModernKeePassLibPCL || KeePassRT
#if ModernKeePassLib || KeePassRT
return string.Compare(strA, strB, m_bCaseInsensitive ?
StringComparison.CurrentCultureIgnoreCase : StringComparison.CurrentCulture);
#else

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -20,7 +20,7 @@
using System;
using System.Diagnostics;
namespace ModernKeePassLibPCL.Security
namespace ModernKeePassLib.Security
{
/// <summary>
/// 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.IO;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization
namespace ModernKeePassLib.Serialization
{
public sealed class BinaryReaderEx
{

View File

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

View File

@@ -23,16 +23,16 @@ using System.Text;
using System.IO;
using System.Diagnostics;
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT)
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
using System.Security.AccessControl;
#endif
using ModernKeePassLibPCL.Native;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Native;
using ModernKeePassLib.Utility;
using System.Threading.Tasks;
using Windows.Storage.Streams;
namespace ModernKeePassLibPCL.Serialization
namespace ModernKeePassLib.Serialization
{
public sealed class FileTransactionEx
{
@@ -61,8 +61,8 @@ namespace ModernKeePassLibPCL.Serialization
m_bTransacted = bTransacted;
m_iocBase = iocBaseFile.CloneDeep();
// ModernKeePassLibPCL is currently targeting .NET 4.5
#if !ModernKeePassLibPCL
// ModernKeePassLib is currently targeting .NET 4.5
#if !ModernKeePassLib
// Prevent transactions for FTP URLs under .NET 4.0 in order to
// 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
@@ -104,14 +104,14 @@ namespace ModernKeePassLibPCL.Serialization
{
bool bMadeUnhidden = UrlUtil.UnhideFile(m_iocBase.Path);
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT)
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
FileSecurity bkSecurity = null;
bool bEfsEncrypted = false;
#endif
if(IOConnection.FileExists(m_iocBase))
{
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT)
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
if(m_iocBase.IsLocalFile())
{
try
@@ -133,7 +133,7 @@ namespace ModernKeePassLibPCL.Serialization
IOConnection.RenameFile(m_iocTemp, m_iocBase);
#if (!ModernKeePassLibPCL && !KeePassLibSD && !KeePassRT)
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
if(m_iocBase.IsLocalFile())
{
try

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,19 +29,19 @@ using System.Diagnostics;
using System.IO.Compression;
#endif
#if ModernKeePassLibPCL
#if ModernKeePassLib
//using PCLStorage;
using Windows.Storage;
#endif
using ModernKeePassLibPCL.Collections;
using ModernKeePassLibPCL.Cryptography;
using ModernKeePassLibPCL.Delegates;
using ModernKeePassLibPCL.Interfaces;
using ModernKeePassLibPCL.Security;
using ModernKeePassLibPCL.Utility;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Delegates;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
namespace ModernKeePassLibPCL.Serialization
namespace ModernKeePassLib.Serialization
{
/// <summary>
/// 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
#if ModernKeePassLibPCL
#if ModernKeePassLib
private XmlWriter m_xmlWriter = null;
#else
private XmlTextWriter m_xmlWriter = null;
@@ -384,14 +384,14 @@ namespace ModernKeePassLibPCL.Serialization
++iTry;
}
#if ModernKeePassLibPCL
#if ModernKeePassLib
//while(FileSystem.Current.GetFileFromPathAsync(strPath).Result != null);
while (StorageFile.GetFileFromPathAsync(strPath).GetResults() != null);
#else
while(File.Exists(strPath));
#endif
#if ModernKeePassLibPCL
#if ModernKeePassLib
byte[] pbData = pb.ReadData();
/*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result;
using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/

View File

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

View File

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

View File

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

View File

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

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