示例#1
0
void TestKeyPairValidAndConsistent(CryptoMaterial &pub, const CryptoMaterial &priv)
{
	if (!pub.Validate(GlobalRNG(), 3))
		SignalTestFailure();
	if (!priv.Validate(GlobalRNG(), 3))
		SignalTestFailure();

/*	EqualityComparisonFilter comparison;
	pub.Save(ChannelSwitch(comparison, "0"));
	pub.AssignFrom(priv);
	pub.Save(ChannelSwitch(comparison, "1"));
	comparison.ChannelMessageSeriesEnd("0");
	comparison.ChannelMessageSeriesEnd("1");
*/
}
示例#2
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();
}
示例#3
0
 QByteArray CppGetByteArray(const CryptoMaterial &cm)
 {
   ByteQueue queue;
   cm.Save(queue);
   QByteArray data(queue.CurrentSize(), 0);
   queue.Get(reinterpret_cast<byte *>(data.data()), data.size());
   return data;
 }