def test_public_key_from_private_key(self): for priv_details in self.priv_pub_addr: txin_type, privkey, compressed = deserialize_privkey(priv_details['priv']) result = ecc.ECPrivkey(privkey).get_public_key_hex(compressed=compressed) self.assertEqual(priv_details['pub'], result) self.assertEqual(priv_details['txin_type'], txin_type) self.assertEqual(priv_details['compressed'], compressed)
def test_serialize_privkey(self): for priv_details in self.priv_pub_addr: txin_type, privkey, compressed = deserialize_privkey( priv_details['priv']) priv2 = serialize_privkey(privkey, compressed, txin_type) self.assertEqual(priv_details['exported_privkey'], priv2)
def sign_message_with_wif_privkey(wif_privkey, msg): txin_type, privkey, compressed = deserialize_privkey(wif_privkey) key = ecc.ECPrivkey(privkey) return key.sign_message(msg, compressed)