23

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.)

Robert Siemer
  • 1,188
  • 1
  • 14
  • 23

3 Answers3

27

This line will do it (found here):

awk '{print $1}' < ~/.android/adbkey.pub | openssl base64 -A -d -a | openssl md5 -c
Robert Siemer
  • 1,188
  • 1
  • 14
  • 23
Organ
  • 386
  • 3
  • 5
  • 3
    awk '{print $1}' < ~/.android/adbkey.pub | base64 --decode | md5sum works as well – Yasushi Shoji Feb 23 '19 at 08:02
  • how do I run this in windows – Pemba Tamang Jun 12 '21 at 05:36
  • since a commit on Nov 15 2018 (https://android.googlesource.com/platform/system/core/+/2dc4cabe0639c71014d729dd92eff19289429c89), adb keygen no longer generates the public key. You can use adb pubkey ~/.android/adbkey | awk '{print $1}' \ | openssl base64 -A -a -d | openssl md5 -c | tr a-z A-Z to get the MD5 fingerprint. Source: https://joachimschuster.de/posts/debug-on-device-rsa-fingerprint – takitsan Mar 09 '23 at 14:58
0

Run:

echo {public key} | base64 --decode | md5sum 
Firelord
  • 25,084
  • 20
  • 124
  • 286
raju
  • 1
  • 1
0

On Android 5 and above, the 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:]'
Andrew T.
  • 15,988
  • 10
  • 74
  • 123
Marisha
  • 111
  • 2