- Finding SHA256 fingerprint for Android signing keys¶
- Using keytool¶
- Using Google Play App Signing¶
- Using GetSocial Gradle plugin¶
- Give us your feedback! Was this article helpful?
- How to Generate SHA1, MD5, and SHA-256 Keys in Android Studio?
- 1. SHA-1 Keys
- 2. MD-5 Keys
- 3. SHA-256 Keys
- Step by Step Guide to Generate SHA1, MD5, and SHA-256 Keys in Android Studio
- How To Generate Certificate Fingerprint SHA-1 Using Android Studio
- What is SHA-1?
- How To Generate SHA-1 Fingerprint
- [Optional] Generate Fingerprints For Release
- Step 1. Create Keystore Properties
- Step 2. Load KeyStore Properties To Gradle
- Step 3. Execute Gradle Task
- Step 4. Find Generated Fingerprint
- Android: How to Get SHA Certificate Fingerprints
- Debug SHA Fingerprints
- Windows
- Upload SHA Fingerprings
- Windows
- App Signing SHA Fingerprints
- Conclusion
Finding SHA256 fingerprint for Android signing keys¶
To setup Android App Links and enable secure connection between SDK and GetSocial API we require SHA256 fingerprints for all signing certificates you use with your Android app.
There are a couple of ways how you can do it: using keytool , Gradle task added by GetSocial Gradle plugin or from Play Console.
Using keytool¶
Locate the keystore file that is used to sign the app. Information about a keystore is obtained by running the keytool (or keytool.exe on Windows) command from the JDK:
You have to replace , , , with your values.
Keytool should output the following text. The SHA256: label identify the respective signature:
Using Google Play App Signing¶
Google Play introduces App Signing service to manage signing certificates. If you have enrolled to the service:
- Login to the Play Console.
- Select the app you want to configure.
- Go to Setup → App integrity
Copy SHA256 values:
Using GetSocial Gradle plugin¶
GetSocial Gradle plugin adds a helper task printSigningCertificateSHA256 to print SHA-256 fingerprints for all configured build flavors:
Give us your feedback! Was this article helpful?
GetSocial empowers mobile app marketing and product teams with growth tools to maximize user acquisition, engagement, and retention.
Источник
How to Generate SHA1, MD5, and SHA-256 Keys in Android Studio?
SHA1, MD5, and SHA-256 are cryptographic functions that will convert your input to 160 bit (20 bytes) value. It is a secure key that is used to store very important data. In Android SHA1, MD5 and SA-256 keys are very important. If you want to add external APIs from Google such as Maps and other external features inside your app, then you have to add your key to Google’s console. The SHA keys are the unique identity of your application. These keys are very important and they are required when you have to add your application to the Google Play store. In this article, we will take a look at creating these keys in Android Studio.
1. SHA-1 Keys
SHA-1 also referred to as the Secure Hash Algorithm. It is a cryptographic hash function that will take input and it produces a 160-bit hash value. This generated hash value is known as a message digest. This generated hash value is then rendered in a hexadecimal format number which is 40 digits long. This key was designed by the United States National Security Agency which was used as an Information Processing Standard. SHA key was introduced in 1995.
Uses of SHA-1 key:
- It is used for Cryptography.
- By using this key the input data is converted into a 160-bit hash value which is difficult to decode.
- These keys are also used for Data Integrity.
2. MD-5 Keys
MD-5 keys are also referred to as Message Digest. These keys are faster than SHA-1 keys and they are simpler in usage than SHA-1 keys. MD-5 is having a length of 128 bits of the message digest. MD-5 is having poor security in comparison to SHA-1 keys. MD-5 key was introduced in 1992.
Uses of MD-5 key:
- MD-5 keys are used for Cryptography.
- They are used to store data in 128-bit values.
3. SHA-256 Keys
SHA-256 is referred to as Secure Hash Algorithm 256. It is a cryptographic hash function that takes an input of 20 bytes and rendered this value in hexadecimal format. The value generated is known as the message digest. The generated hexadecimal value is around 40 digits long.
Uses of SHA-256 key:
- SHA-256 keys are used in Cryptography.
- They are also used in Data Integrity.
Step by Step Guide to Generate SHA1, MD5, and SHA-256 Keys in Android Studio
Step 1: For creating these keys you have to, first of all, create a new project in Android Studio or you can generate these keys in your existing projects as well. If you want to create a new project then check the article on How to Create a new Project in Android Studio.
Step 2: Now inside Android Studio Click on Gradle Tab as shown in the below image.
Step 3: After clicking on Gradle Tab you will get to see the below screen on which click on your “AppName”. After clicking on your App Name then you will get to see three options inside that click on the last options “app“. After clicking on the app, Navigate to “Tasks”. Inside Tasks, navigate to “android” and double click on the “signingreport” option.
After clicking on the “signing report” your keys will be generated as shown in the below screenshot.
You can use these keys while integrating Firebase into your App. When you want to add Google APIs inside your app then these keys are very important.
Источник
How To Generate Certificate Fingerprint SHA-1 Using Android Studio
What is SHA-1?
Secure Hash Algorithm 1 or SHA-1 hash value is a unique representation of a certificate. Typically represented as a hexadecimal number with 40 digits long. This fingerprint value is requested by API providers like Google, Facebook along with package name of the app. They use SHA-1 fingerprint for registering the app to use their services securely.
Since it is a short representation of the developer certificate, it has become an important factor in establishing secure connection between app and service end points.
Today most of the apps depend on third party services and in future also this trend will continue. So i think this tutorial is relevant and will be helpful for Android developers in generating SHA1 fingerprint value.
Another reason is to write this tutorial is, many developers are using command-line tool like keytool for generating SHA1 fingerprint but if you are using Android Studio IDE, then you don’t have to use another tools because it is very simple in Android Studio to generate singing fingerprints.
Gradle is the build system used for Android development in Android studio IDE. Gradle is rich collection of tasks for various purposes. A gradle task named signingReport is responsible for generating fingerprint for the application.
Running the signingReport task against a particular build variant (debug, release) it will generate SHA-1 fingerprint value. SHA-1 fingerprint value will be different for each build variant. i.e, SHA-1 value of debug will be different from SHA-1 value of release build.
singingReport task will generate the following fingerprints,
Note: Best standard out of the above list is, SHA-256
How To Generate SHA-1 Fingerprint
Certificate fingerprints can be generated for any build variants like debug, release. Here i explain simple and secure way of generating fingerprint values which involves following 3 processes,
- Create keystore Properties
- Load keystore To Gradle
- Execute Gradle Task
[Optional] Generate Fingerprints For Release
If you only want SHA1 fingerprint value for debug build variant then you can skip this section to Step 1.
By default the gradle task will not generate fingerprints for release build variant. In most places you will only find how to generated certificate fingerprints for debug build variant but if you published your app in Google Play Store then the live version will be a release build. In this case you need to generate certificate fingerprints for release build variant too.
I will explain how to generate SHA-1 fingerprints for release build variant as well
If you need fingerprints for release build variant also then you have to do 2 additional things before you jump into build.gradle file,
- Create a keystore file (file with .jks extension)
- Add signingConfigs for release
If you already generated signed build for your app then you can skip keystore file creating part and jump to Step 1 and start creating keystore properties.
Keystore file is needed for generating signed apk also. So even if we don’t want to generate a signed apk, generating a signed build would be a good idea to get a keystore file.
Below is the tutorial on how to create a signed apk.
Step 1. Create Keystore Properties
Create a file named keystore.properties in the root directory of your project.
Open the keystore.properties file and past the following content to it.
Replace the above dummy values with your string values.
storeFile variable holds the path to where .jks file to be saved. Better create a folder for keystore file and give the full path of the keystore file.
Step 2. Load KeyStore Properties To Gradle
Once keystore properties file created with your secret credentials, next step is to load the keystore properties to the gradle build configuration. This will give access to the gradle tasks to the keystore properties.
Follow the below instructions to load keystore properties,
In your module’s build.gradle file, add 3 line of code to load your keystore.properties file before the android <> block to load the keystore to gradle.
Next add keystore properties for release build variant also. To do this, copy paste the release tag into signingConfigs
If we miss release singingconfigs then Gradle task will not able to generate certificate fingerprints for release build variants.
Step 3. Execute Gradle Task
signingReport is the name of task that performs the generation of SHA1 fingerprint. In the latest version of Android Studio,
FYI here i am using Android Studio 4.2 for the explanation.
You can find Gradle tab at the right hand-side of the Android Studio IDE. Clicking on the tab will open up the below window.
Click on the Gradle icon (Elephant icon) in the above window. It will open up a sub window,
Type gradle task run command: gradlew singingReport
Enter the command will start execution of gradle task and generate SHA1, MD5, SHA-256 fingerprints.
Step 4. Find Generated Fingerprint
After executing the signingReport you have to open Run tab, which is not selected by default.
Copy the long string shown against SHA1. SHA1 keys are generated and displayed under each build variant i.e, debug, release. Please go to corresponding variant section as shown in the above screenshot.
If you have added sinigingConfigs for release then you will get release variant also in the above result else, release variant will not be available.
Thank you. Please comment here if you have any doubt.
Источник
Android: How to Get SHA Certificate Fingerprints
September 2, 2021
September 8, 2021
When developing and releasing an Android app, we need the following SHA key certificates:
- Debug: Used when developing and debugging. The keystore is saved on your computer.
- Upload: Used to sign each release of your app so that Google knows updates are from you. The keystore is saved on your machine.
- App Siging: Google uses it to sign each of your release. We can get the MD5 and SHA fingerprints from Play Console but the keystore is saved on a Google’s secure server thus it’s unaccessible.
Certificate fingerprints are required to register your key with some API providers (such as Firebase Auth, Firebase Dynamic Links, etc). You can also find more information about the Android keystore system here.
Table of Contents
Debug SHA Fingerprints
If you are using a Mac, open your terminal then run the following command:
And the output should look like this:
Windows
Execute the command below using your Windows command prompt or the terminal that goes with VS Code:
Upload SHA Fingerprings
If you don’t have an upload keystore yet, you need to generate one:
You will have to enter a password. Remember it for later use. A new file named upload-keystore.jks will be created in your home directory.
Now we can get the SHA-1 and SHA-256 fingerprints by executing the following command:
The output should look like this:
Windows
Generate an update keystore if it doesn’t exist:
You will have to enter a password. Remember it because we will use it later. A new file named upload-keystore.jks will be created in c:\Users\ .
Retrieve the SHA-1 and SHA-256 fingerprints:
App Signing SHA Fingerprints
The steps:
1. Log in to your Google Play Console.
2. Select the app you want to get the app signing key associated with it (If you don’t have any apps yet then create one).
3. Head to “Release” > “Setup” > “App Integrity” and you will see the MD5 certificate fingerprint, SHA-1 certificate fingerprint, and SHA-256 certificate fingerprint here:
Conclusion
You’ve explored how to get SHA fingerprints of keystore certificates. If you’d like to learn more about Android and mobile development, take a look at the following articles:
If you have any questions then leave a comment. I will try my best to help. Happy coding!
Источник