def test_aggregate_verify(SKs, messages, result): PKs = [G2Basic.SkToPk(SK) for SK in SKs] messages = [bytes(msg) for msg in messages] signatures = [G2Basic.Sign(SK, msg) for SK, msg in zip(SKs, messages)] aggregate_signature = G2Basic.Aggregate(signatures) assert G2Basic.AggregateVerify(PKs, messages, aggregate_signature) == result
def test_aggregate_verify(SKs, messages, success): PKs = [G2Basic.PrivToPub(SK) for SK in SKs] messages = [bytes(msg) for msg in messages] signatures = [G2Basic.Sign(SK, msg) for SK, msg in zip(SKs, messages)] aggregate_signature = G2Basic.Aggregate(signatures) assert G2Basic.AggregateVerify(zip(PKs, messages), aggregate_signature) == success
def test_core_aggregate_verify(SKs, messages): PKs = [G2Basic.SkToPk(sk) for sk in SKs] messages = [bytes(msg) for msg in messages] signatures = [ G2Basic._CoreSign(sk, msg, G2Basic.DST) for sk, msg in zip(SKs, messages) ] aggregate_signature = G2Basic.Aggregate(signatures) assert G2Basic._CoreAggregateVerify(PKs, messages, aggregate_signature, G2Basic.DST)
def test_aggregate(signature_points, result_point): signatures = [G2_to_signature(pt) for pt in signature_points] result_signature = G2_to_signature(result_point) assert G2Basic.Aggregate(signatures) == result_signature
def test_aggregate(signatures, success): if success: G2Basic.Aggregate(signatures) else: with pytest.raises(ValidationError): G2Basic.Aggregate(signatures)