some handlers, dh pubkey negative problem still not solved...

This commit is contained in:
raphaeIl
2025-01-13 09:11:16 -05:00
parent aae2dc6b55
commit ab8953908e
13 changed files with 19796 additions and 4447 deletions

View File

@@ -27,10 +27,16 @@ namespace Novaria.Common.Crypto
Console.WriteLine(clientPubKeyInt.ToString());
var result = BigInteger.ModPow(clientPubKeyInt, spriv, p);
if (result < 0)
{
result += p; // Make the result non-negative, causes error if -
}
//if (result < 0)
//{
// return result.ToByteArray(false, true)[..32];
//}
//else
//{
//}
return result.ToByteArray(true, true)[..32];
}