def sign(self, data): """Signs some data which can be verified later by others using the public key. :param data: The message to sign. :type data: ``bytes`` :returns: A signature compliant with BIP-62. :rtype: ``bytes`` """ return make_compliant_sig(self._pk.sign(data, ECDSA_SHA256))
def test_r_greater_than_or_equal_to_128(self): # (r = 128, s = 32) signature = b'0\x07\x02\x02\x00\x80\x02\x01 ' assert b'0\x07\x02\x02\x00\x80\x02\x01 ' == make_compliant_sig( signature)
def test_s_greater_than_or_equal_to_128(self): # (r = 32, s = 128) signature = b'0\x07\x02\x01 \x02\x02\x00\x80' assert b'0\x07\x02\x01 \x02\x02\x00\x80' == make_compliant_sig( signature)
def test_normal(self): # (r = 32, s = 32) signature = b'0\x06\x02\x01 \x02\x01 ' assert signature == make_compliant_sig(signature)