keytool is a tool to manage (public/private) security keys and certificates and store them in a Java KeyStore file (stored_file_name. jks). It is provided with any standard JDK / JRE distributions. You can find it under the following folder %JAVA_HOME%\bin .
Add the keytool folder to your system PATH (on Windows) In order to run keytool from the command line, you need to add it to your system PATH. This step is required on Windows only, as keytool will is automatically installed on /usr/bin on macOS/Linux.
I found a solution by myself as below quote. It works fine.
"C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe" -exportcert -alias
> sociallisting -keystore "D:\keystore\SocialListing" |
> "C:\cygwin\bin\openssl.exe" sha1 -binary | "C:\cygwin\bin\openssl.exe"
> base64
Simply enter these into Windows command prompt.
cd C:\Program Files\Java\jdk1.7.0_09\bin
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\userName\.android\debug.keystore" -list -v
The base password is android
You will be presented with the MD5
, SHA1
, and SHA256
keys; Choose the one you need.
To get android key hash code follow these steps (for facebook apps)
cd C:\Program Files\Java\jdk1.6.0_26\bin
keytool -export -alias myAlias -keystore C:\Users\<your user name>\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
To get Certificate fingerprint(MD5) code follow these steps
jarsigner.exe
filecd C:\Program Files\Java\jdk1.6.0_26\bin
keytool -list -keystore "C:/Documents and Settings/<your user name>/.android/debug.keystore"
android
" type and enterkeytool is part of the JDK.
Try to prepend %{JAVA_HOME}\
to the exec statement or c:\{path to jdk}\bin
.
I found this on another post, which did not get many upvotes, but it was super helpful for me. So will add it here.
Android Studio will bring a keytool with it.
C:\Program Files\Android\Android Studio\jre\bin
You can see his post below by Richar Heap, with a helpful reference. I did see this before but forgot about it. https://stackoverflow.com/a/51524526/4446406
The KeyTool is part of the JDK. You'll find it, assuming you installed the JDK with default settings, in $JAVA_HOME/bin
Robby Pond
's answer can be generalized to use JAVA_HOME
environment variable and to also compensate for any blanks that might occur in the path (like Program Files
):
"%JAVA_HOME%\bin\keytool" -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With