KeePassLib selftest class corrected in release

This commit is contained in:
2017-10-23 10:40:51 +02:00
committed by BONNEVILLE Geoffroy
parent a11d209280
commit 8c09d266e8

View File

@@ -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