Exemplo n.º 1
0
bool DL_GroupParameters_DSA::ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const
{
	bool pass = DL_GroupParameters_GFP::ValidateGroup(rng, level);
	pass = pass && DSA::IsValidPrimeLength(GetModulus().BitCount());
	pass = pass && GetSubgroupOrder().BitCount() == 160;
	return pass;
}
bool DL_GroupParameters_DSA::ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const
{
	bool pass = DL_GroupParameters_GFP::ValidateGroup(rng, level);
	int pSize = GetModulus().BitCount(), qSize = GetSubgroupOrder().BitCount();
	pass = pass && ((pSize==1024 && qSize==160) || (pSize==2048 && qSize==224) || (pSize==2048 && qSize==256) || (pSize==3072 && qSize==256));
	return pass;
}
Exemplo n.º 3
0
bool DL_GroupParameters_EC<EC>::ValidateElement(unsigned int level, const Element &g, const DL_FixedBasePrecomputation<Element> *gpc) const
{
	bool pass = !IsIdentity(g) && GetCurve().VerifyPoint(g);
	if (level >= 1)
	{
		if (gpc)
			pass = pass && gpc->Exponentiate(GetGroupPrecomputation(), Integer::One()) == g;
	}
	if (level >= 2)
	{
		const Integer &q = GetSubgroupOrder();
		pass = pass && IsIdentity(gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
	}
	return pass;
}