diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index 015b3ba..a7f9b43 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -365,7 +365,7 @@ class HostKeys (MutableMapping): salt = base64.decodestring(b(salt)) assert len(salt) == SHA.digest_size hmac = HMAC.HMAC(salt, b(hostname), SHA).digest() - hostkey = '|1|%s|%s' % (base64.encodestring(salt), base64.encodestring(hmac)) + hostkey = '|1|%s|%s' % (u(base64.encodestring(salt)), u(base64.encodestring(hmac))) return hostkey.replace('\n', '') hash_host = staticmethod(hash_host) diff --git a/paramiko/transport.py b/paramiko/transport.py index 101fe17..c679a98 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -1747,8 +1747,8 @@ class Transport (threading.Thread): m.add_list(self._preferred_macs) m.add_list(self._preferred_compression) m.add_list(self._preferred_compression) - m.add_string('') - m.add_string('') + m.add_string(bytes()) + m.add_string(bytes()) m.add_boolean(False) m.add_int(0) # save a copy for later (needed to compute a hash) @@ -1948,7 +1948,7 @@ class Transport (threading.Thread): def _parse_disconnect(self, m): code = m.get_int() - desc = m.get_string() + desc = m.get_text() self._log(INFO, 'Disconnect (code %d): %s' % (code, desc)) def _parse_global_request(self, m): diff --git a/tests/test_transport.py b/tests/test_transport.py index 69fdbbb..ccd44e4 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -33,7 +33,7 @@ from paramiko import Transport, SecurityOptions, ServerInterface, RSAKey, DSSKey SSHException, BadAuthenticationType, InteractiveQuery, ChannelException from paramiko import AUTH_FAILED, AUTH_PARTIALLY_SUCCESSFUL, AUTH_SUCCESSFUL from paramiko import OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -from paramiko.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST +from paramiko.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST, b from paramiko.message import Message from tests.loop import LoopSocket from tests.util import ParamikoTest, test_path @@ -162,7 +162,7 @@ class TransportTest(ParamikoTest): self.tc.H = unhexlify('0C8307CDE6856FF30BA93684EB0F04C2520E9ED3') self.tc.session_id = self.tc.H key = self.tc._compute_key('C', 32) - self.assertEquals('207E66594CA87C44ECCBA3B3CD39FDDB378E6FDB0F97C54B2AA0CFBF900CD995', + self.assertEquals(b('207E66594CA87C44ECCBA3B3CD39FDDB378E6FDB0F97C54B2AA0CFBF900CD995'), hexlify(key).upper()) def test_3_simple(self):