Пример #1
0
def test_public_key_to_bytes():
    priv_key = umbral.gen_priv()
    pub_key = umbral.priv2pub(priv_key)

    umbral_key = keys.UmbralPublicKey(pub_key)
    key_bytes = bytes(umbral_key)

    assert type(key_bytes) == bytes
Пример #2
0
def test_public_key_to_bytes(random_ec_bignum1):
    priv_key = random_ec_bignum1

    params = default_params()
    pub_key = priv_key * params.g

    umbral_key = keys.UmbralPublicKey(pub_key)
    key_bytes = bytes(umbral_key)

    assert type(key_bytes) == bytes
Пример #3
0
def test_public_key_serialization():
    priv_key = umbral.gen_priv()
    pub_key = umbral.priv2pub(priv_key)

    umbral_key = keys.UmbralPublicKey(pub_key)

    encoded_key = umbral_key.to_bytes()

    decoded_key = keys.UmbralPublicKey.from_bytes(encoded_key)
    assert pub_key == decoded_key.point_key
Пример #4
0
def test_public_key_serialization(random_ec_bignum1):
    priv_key = random_ec_bignum1

    params = default_params()
    pub_key = priv_key * params.g

    umbral_key = keys.UmbralPublicKey(pub_key)

    encoded_key = umbral_key.to_bytes()

    decoded_key = keys.UmbralPublicKey.from_bytes(encoded_key)
    assert pub_key == decoded_key.point_key