From 926f73a579ea63ec62df46ca3f4c5bc487ec9c00 Mon Sep 17 00:00:00 2001 From: Jeff Irion Date: Sat, 7 Mar 2020 10:29:35 -0800 Subject: [PATCH 1/2] Use null-terminated string for the signed token https://github.com/google/python-adb/pull/152#discussion_r306312516 --- adb_shell/adb_device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb_shell/adb_device.py b/adb_shell/adb_device.py index 976c14c..fa89efc 100644 --- a/adb_shell/adb_device.py +++ b/adb_shell/adb_device.py @@ -237,7 +237,7 @@ def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=consta raise exceptions.InvalidResponseError('Unknown AUTH response: %s %s %s' % (arg0, arg1, banner)) # 6.2. Sign the last ``banner`` and send it in an ``b'AUTH'`` message - signed_token = rsa_key.Sign(banner) + signed_token = rsa_key.Sign(banner) + b'\0' msg = AdbMessage(constants.AUTH, constants.AUTH_SIGNATURE, 0, signed_token) self._send(msg, adb_info) From 38362254b334846a8da08a6703a5ba65a9ddec09 Mon Sep 17 00:00:00 2001 From: Jeff Irion Date: Sat, 13 Jun 2020 18:02:33 -0700 Subject: [PATCH 2/2] Use null-terminated string for the signed token --- adb_shell/adb_device_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb_shell/adb_device_async.py b/adb_shell/adb_device_async.py index d382cad..86ac448 100644 --- a/adb_shell/adb_device_async.py +++ b/adb_shell/adb_device_async.py @@ -232,7 +232,7 @@ async def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s= raise exceptions.InvalidResponseError('Unknown AUTH response: %s %s %s' % (arg0, arg1, banner)) # 6.2. Sign the last ``banner`` and send it in an ``b'AUTH'`` message - signed_token = rsa_key.Sign(banner) + signed_token = rsa_key.Sign(banner) + b'\0' msg = AdbMessage(constants.AUTH, constants.AUTH_SIGNATURE, 0, signed_token) await self._send(msg, adb_info)