Support Signify-based signatures

http://www.openbsd.org/papers/bsdcan-signify.html
This commit is contained in:
Roman Zeyde
2019-07-20 12:52:31 +03:00
committed by Roman Zeyde
parent dbae284487
commit 020572ef5f
5 changed files with 124 additions and 7 deletions

View File

@@ -98,6 +98,11 @@ class Trezor(interface.Device):
return result
def sign(self, identity, blob):
"""Sign given blob and return the signature (as bytes)."""
sig, _ = self.sign_with_pubkey(identity, blob)
return sig
def sign_with_pubkey(self, identity, blob):
"""Sign given blob and return the signature (as bytes)."""
curve_name = identity.get_curve_name(ecdh=False)
log.debug('"%s" signing %r (%s) on %s',
@@ -112,7 +117,7 @@ class Trezor(interface.Device):
log.debug('result: %s', result)
assert len(result.signature) == 65
assert result.signature[:1] == b'\x00'
return bytes(result.signature[1:])
return bytes(result.signature[1:]), bytes(result.public_key)
except self._defs.TrezorFailure as e:
msg = '{} error: {}'.format(self, e)
log.debug(msg, exc_info=True)