ssh: fix unicode identity handling for Python 2

This commit is contained in:
Roman Zeyde
2017-09-22 14:11:21 +03:00
parent ac8898a434
commit 7e95179128
5 changed files with 18 additions and 10 deletions

View File

@@ -77,9 +77,9 @@ class Identity(object):
s = identity_to_string(self.identity_dict)
return unidecode.unidecode(s).encode('ascii')
def __str__(self):
def to_string(self):
"""Return identity serialized to string."""
return '<{}|{}>'.format(identity_to_string(self.identity_dict), self.curve_name)
return u'<{}|{}>'.format(identity_to_string(self.identity_dict), self.curve_name)
def get_bip32_address(self, ecdh=False):
"""Compute BIP32 derivation address according to SLIP-0013/0017."""