Browse Source

add get_public_key method to EC_KEY class

283
ThomasV 11 years ago
parent
commit
cef7bbf294
  1. 3
      lib/bitcoin.py

3
lib/bitcoin.py

@ -371,6 +371,9 @@ class EC_KEY(object):
self.privkey = ecdsa.ecdsa.Private_key( self.pubkey, secret ) self.privkey = ecdsa.ecdsa.Private_key( self.pubkey, secret )
self.secret = secret self.secret = secret
def get_public_key(self, compressed=True):
return point_to_ser(self.pubkey.point, compressed).encode('hex')
def sign_message(self, message, compressed, address): def sign_message(self, message, compressed, address):
private_key = ecdsa.SigningKey.from_secret_exponent( self.secret, curve = SECP256k1 ) private_key = ecdsa.SigningKey.from_secret_exponent( self.secret, curve = SECP256k1 )
public_key = private_key.get_verifying_key() public_key = private_key.get_verifying_key()

Loading…
Cancel
Save