示例#1
0
void TestKeyPairValidAndConsistent(CryptoMaterial &pub, const CryptoMaterial &priv)
{
	// "!!" converts between bool <-> integral.
	if (!pub.Validate(GlobalRNG(), 2U+!!s_thorough))
		SignalTestFailure();
	if (!priv.Validate(GlobalRNG(), 2U+!!s_thorough))
		SignalTestFailure();

	ByteQueue bq1, bq2;
	pub.Save(bq1);
	pub.AssignFrom(priv);
	pub.Save(bq2);
	if (bq1 != bq2)
		SignalTestFailure();
}