17

You should know that Android 4.2.2 (or just before) introduced RSA key checking for adb access. – The device asks now if you want to allow access.

To avoid asking every time, the computer presents an RSA key, which can be permanently accepted.

The dialog on the phone shows the RSA key fingerprint. – On Linux, the public/secret key pair is here: ~/.android/adbkey(.pub).

How can I show the fingerprint of that key file? (I’m looking for a command line to do that on the Linux system.)

3
  • This is also needed when trying to verify the RSA key fingerprint presented when enabling USB debugging. – Jonathan Cross Sep 25 '20 at 16:42
  • adb is usb debugging @JonathanCross – Robert Siemer Sep 25 '20 at 22:39
  • Now the keywords "usb debugging" are inside this answer :-) – Jonathan Cross Sep 29 '20 at 16:17
21

This line will do it (found here):

awk '{print $1}' < ~/.android/adbkey.pub | openssl base64 -A -d -a | openssl md5 -c
1
  • 2
    awk '{print $1}' < ~/.android/adbkey.pub | base64 --decode | md5sum works as well – Yasushi Shoji Feb 23 '19 at 8:02
0

Run:

echo {public key} | base64 --decode | md5sum 
0
0

On Android 5 and up hash-function used was changed to sha256. If your hardware is such, your could try:

awk '{print $1}' < ~/.android/adbkey.pub | openssl base64 -A -d -a | openssl sha256 -c | awk '{print $2}'|tr '[:lower:]' '[:upper:]'

1
  • 3
    On Android 10 I am still getting MD5. – Jonathan Cross Sep 25 '20 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.