Как проверить sha256 в android устройствах
AFV (Android File Verifier)
версия: 2.7
Последнее обновление программы в шапке: 15.07.2017



Краткое описание:
Подсчет MD5/SHA1 и проверка файлов на наличие ошибок.
Инструмент для проверки файлов на целостность.
Функции:
* Подсчет контрольной суммы MD5/SHA1 (также поддерживается SHA-224, SHA-256, SHA-384, SHA-512)
* Проверка подписанных файлов (.jar, .apk, .zip)
* Проверка папки резервного копирования Nandroid (ClockworkMod, Amon_RA, TWRP)
Как пользоваться:
* На главном экране, нажмите кнопку «Выбрать файл», чтобы войти в файловый менеджер
* Самая верхний значок со стрелкой поднимет вас на уровень выше
* Нажмите и удерживайте палец на файле, чтобы просмотреть доступные функции:
— Подсчет MD5
— Подсчет SHA1
— Проверка Jar
— Проверка Nandroid
— Подсчет SHA224
— Подсчет SHA256
— Подсчет SHA384
— Подсчет SHA512
— Md5sum (Проверка файла .md5)
Android: How to Get SHA Certificate Fingerprints

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).
Optional: You can also find more information about the Android Keystore system here.
How to verify SHA256 fingerprint of APK
I have downloaded the signal app from https://signal.org/android/apk/. To verify the download, there is a fingerprint provided. But how can I verify this fingerprint with the file? I know that I can use sha256sum to verify a hash, but I guess for a fingerprint I need a certificate or something similar?
4 Answers 4
You’ve missed a key word in the download page:
You can verify the signing certificate on the APK matches this SHA256 fingerprint
APK files are just ZIP files in reality, so open it up with whatever archive tool you want (I use 7zip) and extract META-INF\CERT.RSA from it. You can then verify that the certificate fingerprint matches what is written on the site. Note that this isn’t the same as the hash of the whole certificate either! You’ll need to use keytool to check it.
The keytool binary is included in the Java JDK (usually in the %ProgramFiles%\Java\jdk_<version>\bin\ directory), and can be used as follows:
Output looks like this:
You can see that the SHA256 fingerprint matches what we saw on the site.
Once you’ve verified this you can go ahead and install the APK onto your Android device. Since you’ve verified that the signing certificate inside the APK matches the one that Signal expects you to see, you can then rely upon the Android operating system to validate that the APK is properly signed — it won’t allow you to load it otherwise.
The correct way to verify an APK file is to use apksigner from Android SDK.
In difference to the other answers here that base on keytool , apksigner has two major advantages:
- It actually verifies that that the signature is correct and the APK has not been modified
- It does not rely on the old APK signature scheme v1 (also known as "JAR signature"). Instead it also can process APKs that has been signed using the APK signature scheme v2 and v3 (there are already apps available that doen’t have an v1 signature at all, therefore those apps can’t be checked using keytool .
apksigner is part of the Android build tools, therefore you may find multiple versions installed, one for each build-tools version installed.
One example path within the Android SDK to apksigner.bat / apksigner.sh is:
Execute apksigner this way:
Now you have verified the APK, but you still don’t know if you can trust the person/organization who has signed the APK file. This is because on Android APK signatures use by definition self-signed certificates. If you can trust a certificate is therefore a difficult question. The only way is to check the other apps that have been signed using the same certificate.
Does every Android phone support SHA-256
I’m curious; which phones will support SHA-256? In the docs, the line about the ‘NoSuchAlgorithmException’ makes me think that some phones don’t support all algorithms. Before I go implementing this for an app and expecting it to work the same on all phones I want to know if anyone knows anything about this.
I find it strange that the MessageDigest class doesn’t have some constants to pick the algorithm you want to use.
4 Answers 4
All Android devices support SHA-256. The NoSuchAlgorithmException indicates that a requested algorithm could not be found and is necessary because the method takes a String argument for the algorithm name. If you passed in «foo-256», the method’s only recourse is to throw a NoSuchAlgorithmException because, for reasons beyond my understanding, there’s no algorithm called «foo-256». Assuming you’re passing in a name you’re sure is an algorithm that Android can use, you’ll never see that exception.