Remember the good primes to prevent verifying them twice

This commit is contained in:
Wizou 2021-09-01 23:03:04 +02:00
parent 3701ba6f72
commit 67285c1c08
4 changed files with 13 additions and 11 deletions

View file

@ -194,7 +194,7 @@ namespace WTelegram
private static void ValidityChecks(BigInteger p, int g)
{
Helpers.Log(2, "Verifying encryption key safety... (this happens only during session negociation)");
Helpers.Log(2, "Verifying encryption key safety... (this should happen only once)");
// check that 2^2047 <= p < 2^2048
if (p.GetBitLength() != 2048) throw new ApplicationException("p is not 2048-bit number");
// check that g generates a cyclic subgroup of prime order (p - 1) / 2, i.e. is a quadratic residue mod p.