1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

protobuf: encode to utf-8 bytestream

This commit is contained in:
Pavol Rusnak 2017-12-18 22:43:31 +01:00
parent 094d0b6ffb
commit 753e91dff0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 3 additions and 3 deletions

View File

@ -632,7 +632,7 @@ class ProtocolMixin(object):
def sign_message(self, coin_name, n, message, script_type=proto.InputScriptType.SPENDADDRESS):
n = self._convert_prime(n)
# Convert message to UTF8 NFC (seems to be a bitcoin-qt standard)
message = normalize_nfc(message).encode("utf-8")
message = normalize_nfc(message).encode('utf-8')
return self.call(proto.SignMessage(coin_name=coin_name, address_n=n, message=message, script_type=script_type))
@expect(proto.SignedIdentity)
@ -786,7 +786,7 @@ class ProtocolMixin(object):
def verify_message(self, coin_name, address, signature, message):
# Convert message to UTF8 NFC (seems to be a bitcoin-qt standard)
message = normalize_nfc(message).encode("utf-8")
message = normalize_nfc(message).encode('utf-8')
try:
resp = self.call(proto.VerifyMessage(address=address, signature=signature, message=message, coin_name=coin_name))
except CallException as e:

View File

@ -290,7 +290,7 @@ def dump_message(writer, msg):
elif ftype is UnicodeType:
if not isinstance(svalue, bytes):
svalue = svalue.encode()
svalue = svalue.encode('utf-8')
dump_uvarint(writer, len(svalue))
writer.write(svalue)