mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 16:10:16 -04:00
WIP KeePassLibPCL - problem with awaitables
This commit is contained in:
@@ -21,15 +21,16 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
using ModernKeePassLib.Cryptography;
|
||||
using ModernKeePassLib.Cryptography.Cipher;
|
||||
using ModernKeePassLib.Utility;
|
||||
using ModernKeePassLibPCL.Cryptography;
|
||||
using ModernKeePassLibPCL.Cryptography.Cipher;
|
||||
using ModernKeePassLibPCL.Native;
|
||||
using ModernKeePassLibPCL.Utility;
|
||||
|
||||
#if KeePassLibSD
|
||||
using KeePassLibSD;
|
||||
#endif
|
||||
|
||||
namespace ModernKeePassLib.Security
|
||||
namespace ModernKeePassLibPCL.Security
|
||||
{
|
||||
[Flags]
|
||||
public enum PbCryptFlags
|
||||
@@ -85,19 +86,17 @@ namespace ModernKeePassLib.Security
|
||||
{
|
||||
#if KeePassLibSD
|
||||
return false;
|
||||
#elif PCL
|
||||
return false;
|
||||
#else
|
||||
bool? ob = g_bProtectedMemorySupported;
|
||||
if(ob.HasValue) return ob.Value;
|
||||
|
||||
// Mono does not implement any encryption for ProtectedMemory;
|
||||
// https://sourceforge.net/p/keepass/feature-requests/1907/
|
||||
/*if(NativeLib.IsUnix())
|
||||
if(NativeLib.IsUnix())
|
||||
{
|
||||
g_bProtectedMemorySupported = false;
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
|
||||
ob = false;
|
||||
try // Test whether ProtectedMemory is supported
|
||||
@@ -242,15 +241,14 @@ namespace ModernKeePassLib.Security
|
||||
return;
|
||||
}
|
||||
|
||||
#if !PCL
|
||||
if(ProtectedBinary.ProtectedMemorySupported)
|
||||
if(ProtectedBinary.ProtectedMemorySupported)
|
||||
{
|
||||
ProtectedMemory.Protect(m_pbData, MemoryProtectionScope.SameProcess);
|
||||
|
||||
m_mp = PbMemProt.ProtectedMemory;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
byte[] pbKey32 = g_pbKey32;
|
||||
if(pbKey32 == null)
|
||||
{
|
||||
@@ -270,10 +268,9 @@ namespace ModernKeePassLib.Security
|
||||
private void Decrypt()
|
||||
{
|
||||
if(m_pbData.Length == 0) return;
|
||||
#if !PCL
|
||||
|
||||
if(m_mp == PbMemProt.ProtectedMemory)
|
||||
ProtectedMemory.Unprotect(m_pbData, MemoryProtectionScope.SameProcess);
|
||||
#endif
|
||||
else if(m_mp == PbMemProt.Salsa20)
|
||||
{
|
||||
Salsa20Cipher s = new Salsa20Cipher(g_pbKey32,
|
||||
|
@@ -21,8 +21,8 @@ using System;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
using ModernKeePassLib.Cryptography;
|
||||
using ModernKeePassLib.Utility;
|
||||
using ModernKeePassLibPCL.Cryptography;
|
||||
using ModernKeePassLibPCL.Utility;
|
||||
|
||||
#if KeePassLibSD
|
||||
using KeePassLibSD;
|
||||
@@ -30,7 +30,7 @@ using KeePassLibSD;
|
||||
|
||||
// SecureString objects are limited to 65536 characters, don't use
|
||||
|
||||
namespace ModernKeePassLib.Security
|
||||
namespace ModernKeePassLibPCL.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an in-memory encrypted string.
|
||||
|
@@ -20,7 +20,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ModernKeePassLib.Security
|
||||
namespace ModernKeePassLibPCL.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an object that is encrypted using a XOR pad until
|
||||
|
Reference in New Issue
Block a user