mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
KeePassLib selftest class corrected in release
This commit is contained in:
@@ -687,7 +687,8 @@ namespace ModernKeePassLib.Cryptography
|
|||||||
private static void HmacEval(byte[] pbKey, byte[] pbMsg,
|
private static void HmacEval(byte[] pbKey, byte[] pbMsg,
|
||||||
byte[] pbExpc, string strID)
|
byte[] pbExpc, string strID)
|
||||||
{
|
{
|
||||||
/*#if ModernKeePassLib
|
#if ModernKeePassLib
|
||||||
|
/*
|
||||||
// WinRT
|
// WinRT
|
||||||
var h = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha256).CreateHash(CryptographicBuffer.CreateFromByteArray(pbKey));
|
var h = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha256).CreateHash(CryptographicBuffer.CreateFromByteArray(pbKey));
|
||||||
h.Append(CryptographicBuffer.CreateFromByteArray(pbMsg));
|
h.Append(CryptographicBuffer.CreateFromByteArray(pbMsg));
|
||||||
@@ -712,8 +713,8 @@ namespace ModernKeePassLib.Cryptography
|
|||||||
//h.BlockUpdate(pbMsg, 0, pbMsg.Length);
|
//h.BlockUpdate(pbMsg, 0, pbMsg.Length);
|
||||||
//h.DoFinal(pbHash, 0);
|
//h.DoFinal(pbHash, 0);
|
||||||
//if (!MemUtil.ArraysEqual(pbHash, pbExpc))
|
//if (!MemUtil.ArraysEqual(pbHash, pbExpc))
|
||||||
// throw new SecurityException("HMAC-SHA-256-" + strID + "-R");
|
// throw new SecurityException("HMAC-SHA-256-" + strID + "-R");*/
|
||||||
#else*/
|
#else
|
||||||
// Original
|
// Original
|
||||||
using(HMACSHA256 h = new HMACSHA256(pbKey))
|
using(HMACSHA256 h = new HMACSHA256(pbKey))
|
||||||
{
|
{
|
||||||
@@ -733,7 +734,7 @@ namespace ModernKeePassLib.Cryptography
|
|||||||
if(!MemUtil.ArraysEqual(pbHash, pbExpc))
|
if(!MemUtil.ArraysEqual(pbHash, pbExpc))
|
||||||
throw new SecurityException("HMAC-SHA-256-" + strID + "-R");
|
throw new SecurityException("HMAC-SHA-256-" + strID + "-R");
|
||||||
}
|
}
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user