Issue
I'm trying to make a script that will take control of an android device in a farm with adb connect
making the connection through OpenSTF. One of the requirements for the device to accept the connection from a client is to provide the content of adbkey.pub in OpenSTF.
However, it seems that newer versions of ADB do not generate this file anymore, only the private key. From what I could collect from the AOSP repository, this is intentional https://github.com/aosp-mirror/platform_system_core/commit/2dc4cabe0639c71014d729dd92eff19289429c89
After reviewing the AOSP commit I realized that ADB keypairs are made with the RSA protocol, and I found an example of how to obtain the public key from the private in this Stack Exchange question. However, the format of the public key for the OpenSSL output and the adbkey.pub are different. At first I thought that it's just encoded in base64 but even with this the outputs don't match.
This is an example of an ADB public key from adb keygen
using an older version of ADB.
QAAAAFNrmDYl72IeYbMQiOlKulhv2lH3CKyeK6EgwyUxptsdPmvCCRmxtvecilLzE74OzoRVQKZeCBI/qMnWj1hBU8t6YE0FQ1CUKAFO5UYp/S7GH/+tlHKunl/mmm/Izjs4L6ajl+kp3XBBrYryIJtRH5iJRi9T96gRq2ya+h9v/v/ITNvdCKLNVObBCLCj+4fmkoxVEXnSLyQtyPAl/AiMAiK/WXryatNkuBdAr6m9M/ay693Oj07I3UFxLqzwHhoeb2CZzC0//AwUDgRHtyxDyrAKaoxirhoaJ4Q8Tbn6jRtOaV0uvtCBfs4kIUoM/DLPfjZq8Al8PHPuEwvOMaAGF+JSXHywjWfstcxT3c7xjn2Zq19R4kuf63dfEqtv+NA/PhH94oMQtiZsp92JpT0h22tWAoQAF9jr2puwVzMj8i/k0iDLMRnp/5E6UVsziP8PG9DgIpeTjL2NMjE0Kheq+CufIozhcvGudg+MJaJED4XHK7hQrU0QCvu1kOqO+/VtW4zmTCfg8nY556A73vtllrMLsG2OgZTyQT0SrBOBd2AaYOB90l7//hlfpqAA8XANG0MHkyPsi/xtKga6Zsu+a2L9Hl2rUWNB6T9AEmyzmapCMUBilAuNtZ+Pt9esqzD9+/aKSIHdUu1gPKZtKTgh+pqYNgyipq0UMWpexkZfpMsLTddGIgEAAQA= carolinadp@carolinadp-GL62M-7RD
And this is a public key made with OpenSSL from the same private key
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsHxcUuIXBqAxzgsT7nM8
fAnwajZ+zzL8DEohJM5+gdC+Ll1pThuN+rlNPIQnGhquYoxqCrDKQyy3RwQOFAz8
Py3MmWBvHhoe8KwucUHdyE6Pzt3rsvYzvamvQBe4ZNNq8npZvyICjAj8JfDILSQv
0nkRVYyS5of7o7AIweZUzaII3dtMyP/+bx/6mmyrEaj3Uy9GiZgfUZsg8oqtQXDd
KemXo6YvODvOyG+a5l+ernKUrf8fxi79KUblTgEolFBDBU1gestTQViP1smoPxII
XqZAVYTODr4T81KKnPe2sRkJwms+HdumMSXDIKErnqwI91Hab1i6SumIELNhHmLv
JQIDAQAB
-----END PUBLIC KEY-----
How can I obtain the ADB public key?
Solution
I have got the "Connection refused" problem on OpenSTF when my adb version is upgraded to Version 28.0.2-5303910(so the adbkey.pub is gone)
Android Debug Bridge version 1.0.40
Version 28.0.2-5303910
and now I finally solved it just by upgraded adb to the latest version
Android Debug Bridge version 1.0.41
Version 29.0.6-6198805
Hope this helps.
Answered By - EchoChan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.