user2208349
user2208349

Reputation: 7709

SHA-1 fingerprint of keystore certificate

Is the method for getting an SHA-1 fingerprint the same as the method of getting the fingerprint? Previously, I was running this command:

Windows Command Prompt running keytool.exe

It's not clear to me if the result I'm getting is the SHA-1 fingerprint. Can somebody clarify this?

Upvotes: 660

Views: 1123413

Answers (30)

Muhammad Umair Saqib
Muhammad Umair Saqib

Reputation: 1865

We can also generate a SHA1 key by a simple method. If you are in the Flutter project, first navigate to the Android module using cd android and type **./gradlew signingReport**. This will generate SHA1 and SHA2 keys.

Upvotes: 0

Jorgesys
Jorgesys

Reputation: 126563

The new method to get SHA-1 certificate in Android Studio, is opening Gradle from the elephant icon in the right menu, then select the icon and inside "Run Anything" write: gradle signingReport then Enter

enter image description here



Legacy method in Eclipse

from a Debug Keystore we can get the SHA1 value in Eclipse. Accessing from the menu: Window -> Preferences -> Android -> Build

but it doesn´t work for a production Keystore. enter image description here

So, to get the SHA1 value from a production Keystore go to: Android Tools -> Export Signed Application Package. Follow the process for signing your apk and the SHA1 will showed as a certificate.

enter image description here

Upvotes: 21

Roman
Roman

Reputation: 870

Android Studio Giraffe | 2022.3.1 onward - new IntelliJ UI:

  1. Open Execute Gradle Task enter image description here

  2. Run the command gradle signingReport enter image description here

  3. Inspect run enter image description here

Upvotes: 3

Surajkaran Meghwanshi
Surajkaran Meghwanshi

Reputation: 686

Many ways to get SHA1 and SHA-256 key . To generate the SHA-1 key for your Android app, there are a few alternative methods:

Using Keytool Command-Line Tool: You can use the keytool command-line tool that comes with the Java Development Kit (JDK) to generate the SHA-1 key. Open a terminal or command prompt and navigate to your JDK's bin directory. Then run the following command: bash

keytool -list -v -keystore your_keystore_file.jks -alias your_alias_name

Replace your_keystore_file.jks with the path to your keystore file and your_alias_name with the alias you used to sign your app.

Using Android Studio: Android Studio provides a straightforward way to get the SHA-1 key. Follow these steps: Click on the "Gradle" tab on the right side of the Android Studio window. Navigate to "Your Project" -> "Tasks" -> "Android" -> "signingReport". Double-click on "signingReport" to run the task, which will output the SHA-1 key and other signing information in the "Run" pane. Using Google Play Console: If you have already uploaded your app to the Google Play Console, you can find the SHA-1 key in the "Release management" -> "App signing" section.

Using Online Tools: There are some online tools available where you can upload your keystore file and get the SHA-1 key as a result. However, for security reasons, it's generally better to generate the SHA-1 key locally using trusted tools like the ones mentioned above.

Using Gradle Plugin: You can also use the Gradle Signing Report Plugin to get the SHA-1 key. Add the following to your app's build.gradle file:

apply plugin: 'signing-report'

signingReport {
    // You can configure signing configs here if needed
}

Then run the signingReport Gradle task. You will find the SHA-1 key printed in the console. All these methods will provide you with the SHA-1 key needed for various purposes, such as integrating Google services or configuring API access. Choose the one that fits your workflow and security requirements best.

Upvotes: 6

Gourav Dadhich
Gourav Dadhich

Reputation: 73

please try this

go to Gradle -> click no elephant icon and write signingReport and click enter done

Upvotes: 1

Vishal Beep
Vishal Beep

Reputation: 2023

An easy answer. To find SH1 in the new Android Studio Version. Do these simple steps.

Step 1 Go to setting and you can also press CTRL + ALT + S

Edit

Step 2 for latest android studio including - Android Studio Electric Eel | 2022.1.1

Go to Experimental and then UnTick the option named Only include test tasks in the Gradle task list generated during Gradle Sync if it is Ticked and then press ok

Step 2 for older versions of the android studio -

Go to Experimental and then UnTick the option named Do not build Gradle task during Gradle sync if it is Ticked and then press ok

Continue

Step 3 Go to File then choose the option of Sync Project with Gradle files

Step 4 Click on Gradle on the right side of panel then Tasks then android then double click on signingReport

Then you will get the SH1 fingerprint

enter image description here

Upvotes: 47

S for Source Code
S for Source Code

Reputation: 41

In Flutter Project continue in vs code and paste this command

set your username

keytool -list -v -keystore "c:\users\your_pc_username\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android 

Upvotes: 3

Jayakrishnan
Jayakrishnan

Reputation: 4677

If you are using Android Studio IDE then you can get SHA1 has value for your all build variants with one click.

Under Gradle Projects Window > Select Root Project > signingReport > double click

File Navigation

Next

Open Run Window

Go To Variant: release for release

Go To Variant: debug for debug

Upvotes: 8

Maruf Hassan
Maruf Hassan

Reputation: 1248

This is the solution for macOS Ventura 13.0 on MacBook Pro M2 2022

I needed SHA1 key for Google Cloud.

  1. Run this command in your terminal where your project is. I was working on a Flutter project.

keytool -keystore path-to-debug-or-production-keystore -list -v

If it doesn't work and you get this error, follow along.

enter image description here

  1. Go to https://www.java.com and download and install the latest version of Java. Run the above command again, if you get another error like this follow along.

enter image description here

  1. Run this command and this will give you SHA1, SHA256, MD5 for default debug key. And it can be used for developing and debugging with google play services.

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

enter image description here

Upvotes: 5

mikail yusuf
mikail yusuf

Reputation: 337

A simpler method is to run ./gradlew signingReport in your project root directory Other methods are explained in this article

Upvotes: 3

Omkar
Omkar

Reputation: 3100

use android studio embedded Java jre location, for windows user below screenshot may help to find SHA1

enter image description here

Upvotes: 2

azdeviz
azdeviz

Reputation: 758

on the new update just go to Android folder and type ./gradlew signingReport

Upvotes: 11

sachin singh jagawat
sachin singh jagawat

Reputation: 109

In the recent update of Android Studio 4.2, we are unable to get the file: signing report. So, we can get this again by following the following steps:

File -> Settings -> Experimental -> 
Now we need to uncheck the *do not build Gradle list during Gradle sync* ->
Click Ok -> now again go to File -> Click on *Sync Project with Gradle files*

Now you can follow, what other answers tell.

Thanks to @PapayaCoders Youtube channel to resolve this issue. Here is the link of the video concerning this problem.

Upvotes: 3

Rahul Kushwaha
Rahul Kushwaha

Reputation: 6742

For Android Studio 4.2 and newer version ,follows these steps to generate SHA Key . Steps are given in these pictures.

Steps:-

1) Click on the gradle. Top right on the Android Studio. As you can see in this picture.

Step1

2) Now click on icon as seen in below picture. A new searchable windows/screen will open.

SHA2

3) Now type,gradle signingreport and press Enter to start generating SHA KEY as seen in below picture.

sha3

4) Your SHA Key will generate as seen in this picture. Using these steps you can generate SHA KEY in Android Studio 4.2.

sha4

Upvotes: 27

Jewel Rana
Jewel Rana

Reputation: 2796

Easy method - with Keystore explorer

Follow the step

  1. Download keystore explorer Download link
  2. Install keystore explorer
  3. Open keystore via keystore explorer
  4. Enter password
  5. Click your keystore name
  6. then you will get the sha1 key

Upvotes: 4

Amol Sawant
Amol Sawant

Reputation: 14342

Follow this tutorial for creating SHA1 fingerprint for Google Map v2

For Debug mode:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android 

for Release mode:

keytool -list -v -keystore {keystore_name} -alias {alias_name}

example:

keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test

On windows, when keytool command is not found, Go to your installed JDK Directory e.g. <YourJDKPath>\Java\jdk1.8.0_231\bin\, open command line and try the above commands for debug/release mode.

Another way of getting your SHA1 OR SHA-256 use ./gradlew signingReport

For more detailed info visit Using Gradle's Signing Report

Upvotes: 1259

Rushikesh Chavan
Rushikesh Chavan

Reputation: 121

[![Change the build variant then you can see the run the application which will lead to error

You have to find SHA1 code for Release Key & enter it on your Developer Console. ( for me developer console is firebase some people might use different services) To find SHA1 Code . easy way is

Go to Build --- Select Build Variant -- On the left Side Select "Release" as build variant -- now go to module settings ( or try to run project , android studio will tell you about a error and click fix error button) --- Select Signing tab --- add your release key and passwords -- now goto build types -- select release -- on signing config select your release key config -- now run your project -- now run your signing report --- you can find SHA1 under release build -- enter that sha1 code on your developer console

enter image description here

enter image description here

enter image description here

That's it

Upvotes: 1

mustangDC
mustangDC

Reputation: 967

As of Sept 2020, if you want to get the SHA-1 fingerprint of keystore certificate of Release. Simply open up your Google Play Developer Console and open the App Signing tab.

enter image description here

Upvotes: 5

glinda93
glinda93

Reputation: 8479

If you're using React Native, debug.keystore is in android/app, but may not be in ~/.android.

Set debug.keystore path as the following:

keytool -list -v -keystore {PROJECT_ROOT}/android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android

Console will print something like this:

Alias name: androiddebugkey
Creation date: Jan 1, 2014
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, OU=Android, O=Unknown, L=Unknown, ST=Unknown, C=US
Issuer: CN=Android Debug, OU=Android, O=Unknown, L=Unknown, ST=Unknown, C=US
Serial number: 2==Serial Number==2
Valid from: Wed Jan 01 06:35:04 CST 2014 until: Wed May 01 06:35:04 CST 2052
Certificate fingerprints:
     SHA1: 5E:=========== SHA1 SIGNING KEY ===========:25
     SHA256: FA:============ SHA 256 ===================9C
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Upvotes: 3

XpressGeek
XpressGeek

Reputation: 3697

Step 1 : First locate your JDK's bin folder in your windows pc. See the image below.

Mine is :

C:\Program Files\Java\jdk1.8.0_131\bin

enter image description here

Step 2 : Now search for Command Prompt by typing "cmd" in windows 10 search bar. Then open Command Prompt as Administrator mode. See the image below:

enter image description here

Step 3 : Now copy this path and type it into Command Prompt

 C:\Program Files\Java\jdk1.8.0_131\bin

enter image description here

In Command Prompt :

cd C:\Program Files\Java\jdk1.8.0_131\bin

enter image description here

After pressing Enter button you will go to the bin folder.

enter image description here

Your setup is done. Now generate your SHA1 key for Release mode.

Release SHA1 Key :

keytool -list -v -keystore C:\Users\Turzo\Desktop\earninglearning.keystore -alias turzo -storepass 12345678 -keypass 12345678

enter image description here

Upvotes: 9

Monster
Monster

Reputation: 105

This solution is for android studio 3.5 version:

  1. Open your project into Android studio.
  2. Click on Gradle tab on right side.
  3. Will see two things one is our project(root) and just app.
  4. Select our project in your case it might be your app.
  5. Right click on the project and refresh it.
  6. Then click on the the project drop don button.
  7. Click on the Tasks where will see android folder.
  8. Double Click on signingReport and will see the details in Run console.

Upvotes: 6

Sana Ebadi
Sana Ebadi

Reputation: 7220

if you have not the Keystore and alias you can use this command :

keytool -list -printcert -jarfile app.apk

Upvotes: 3

Keshav Gera
Keshav Gera

Reputation: 11264

enter image description here

Right side Gradle --> signing project get all keys

Upvotes: 8

Muhammad Zacky Asyari
Muhammad Zacky Asyari

Reputation: 327

I had a problem during opening with command

[keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test]

Therefore, i download https://sourceforge.net/projects/portecle/. Then just open .jks file from the jar program. it will show you all relevant information

snapshot of the program

Upvotes: 4

Amir Dora.
Amir Dora.

Reputation: 2717

This is step by step process of what worked for me.

First run the app then follow steps below (also shown in screenshot)

  1. click signing report
  2. open gradle console dialog
  3. it should display your SHA-1 certificate number

enter image description here

Upvotes: 35

AndroidLearner
AndroidLearner

Reputation: 751

Using Google Play app signing feature & Google APIs integration in your app?

  1. If you are using Google Play App Signing, don't forget that release signing-certificate fingerprint needed for Google API credentials is not the regular upload signing keys (SHA-1) you obtain from your app by this method:

Upload signing certificate

  1. You can obtain your release SHA-1 only from App signing page of your Google Play console as shown below:-

If you use Google Play app signing, Google re-signs your app. Thats how your signing-certificate fingerprint is given by Google Play App Signing as shown below:

App Signing page - Google Play Console

Read more How to get Release SHA-1 (Signing-certificate fingerprint) if using 'Google Play app signing'

Upvotes: 31

AnupamChugh
AnupamChugh

Reputation: 1899

In Addition to Lokesh Tiwar's answer

For release builds add the following in the gradle:

android {

defaultConfig{
//Goes here
}

    signingConfigs {
        release {
            storeFile file("PATH TO THE KEY_STORE FILE")
            storePassword "PASSWORD"
            keyAlias "ALIAS_NAME"
            keyPassword "KEY_PASSWORD"
        }
    }
buildTypes {
        release {
            zipAlignEnabled true
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

Now running the signingReport as in Lokesh's Answer would show the SHA 1 and MD5 keys for the release builds as well.

Sample

Upvotes: 6

J Wang
J Wang

Reputation: 2115

If you are using Google Play App Signing, instead of getting the SHA from the keystore, an easier way is to go to the Google Play Console > Your app > Release Management > App signing and look for your upload certificate.

Screenshot of the page where you get this info

Upvotes: 3

Lokesh Tiwari
Lokesh Tiwari

Reputation: 10586

If you are using android studio use simple step

  1. Run your project
  2. Click on Gradle menu
  3. Expand Gradle Tasks tree
  4. Double click on android -> signingReport and see the magic
  5. It will tell you everything on the Run tab

enter image description here

Result Under Run Tab If Android Studio < 2.2
enter image description here

From android studio 2.2
Result will be available under Run console but use highlighted toggle button

enter image description here

Or
Second Way is
Create new project in android studio New -> Google Maps Activity

enter image description here

then open google_maps_api.xml xml file as shown in pics you will see your SHA key

enter image description here

Upvotes: 743

Try this with your user & pass

keytool -list -v -keystore {path of jks file} -alias {keyname} -storepass {keypassword} -keypass {aliaspassword}

Exe

keytool -list -v -keystore "E:\AndroidStudioProject\ParathaApp\key.jks" -alias key0 -storepass mks@1 -keypass golu@1

Upvotes: 1

Related Questions