mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
ModernKeePassLib namespace restoration
This commit is contained in:
@@ -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);
|
||||
|
@@ -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.
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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>
|
||||
{
|
||||
|
@@ -21,7 +21,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ModernKeePassLibPCL.Keys
|
||||
namespace ModernKeePassLib.Keys
|
||||
{
|
||||
public enum KeyValidationType
|
||||
{
|
||||
|
@@ -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>
|
||||
{
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace ModernKeePassLibPCL.Keys
|
||||
namespace ModernKeePassLib.Keys
|
||||
{
|
||||
[Flags]
|
||||
public enum UserKeyType
|
||||
|
Reference in New Issue
Block a user