Beispiel #1
0
def test_cannot_create_capsule_from_bogus_material(alices_keys):
    params = alices_keys[0].params

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(
            params,
            point_e=Point.gen_rand(),
            point_v=42,
            bn_sig=CurveBN.gen_rand())

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(
            params,
            point_e=Point.gen_rand(),
            point_v=Point.gen_rand(),
            bn_sig=42)

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(
            params,
            point_e_prime=Point.gen_rand(),
            point_v_prime=42,
            point_noninteractive=Point.gen_rand())

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(
            params,
            point_e_prime=Point.gen_rand(),
            point_v_prime=Point.gen_rand(),
            point_noninteractive=42)
def test_cannot_create_capsule_from_bogus_material(alices_keys):
    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(point_eph_e=Point.gen_rand(),
                                                        point_eph_v=42,
                                                        bn_sig=BigNum.gen_rand())

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(point_eph_e=Point.gen_rand(),
                                                        point_eph_v=Point.gen_rand(),
                                                        bn_sig=42)

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(e_prime=Point.gen_rand(),
                                                        v_prime=42,
                                                        noninteractive_point=Point.gen_rand())

    with pytest.raises(TypeError):
        capsule_of_questionable_parentage = pre.Capsule(e_prime=Point.gen_rand(),
                                                        v_prime=Point.gen_rand(),
                                                        noninteractive_point=42)