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
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
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
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