Add sign and verify operations for secp256k1 keys

This commit is contained in:
Alex Stokes 2019-08-23 16:54:31 +02:00
parent 3c97a5a0ed
commit fb13dfa7b3
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086

View File

@ -19,7 +19,7 @@ class Secp256k1PublicKey(PublicKey):
return KeyType.Secp256k1 return KeyType.Secp256k1
def verify(self, data: bytes, signature: bytes) -> bool: def verify(self, data: bytes, signature: bytes) -> bool:
raise NotImplementedError return self.impl.verify(signature, data)
class Secp256k1PrivateKey(PrivateKey): class Secp256k1PrivateKey(PrivateKey):
@ -38,7 +38,7 @@ class Secp256k1PrivateKey(PrivateKey):
return KeyType.Secp256k1 return KeyType.Secp256k1
def sign(self, data: bytes) -> bytes: def sign(self, data: bytes) -> bytes:
raise NotImplementedError return self.impl.sign(data)
def get_public_key(self) -> PublicKey: def get_public_key(self) -> PublicKey:
public_key_impl = coincurve.PublicKey.from_secret(self.impl.secret) public_key_impl = coincurve.PublicKey.from_secret(self.impl.secret)