keytool : SHA256withRSA written instead of an actual SHA256 on my production keystore

Viewed 1085

I need to get the sha256 fingerprint for appsflyer.

However, when executing

keytool -list -v -alias myaliad -keystore ./mykey.keystore

I get the following output, where, instead of an actual SHA256 value, I get "SHA256withRSA".

Nom d'alias : myapp
Date de création : 11 janv. 2017
Type d'entrée : PrivateKeyEntry
Longueur de chaîne du certificat : 1
Certificat[1]:
Propriétaire : CN=SomeDude, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Fr
Emetteur : CN=SomeDude, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Fr
Numéro de série : 583ebd9
Valide du : Wed Jan 11 19:03:04 CET 2017 au : Tue Dec 04 19:03:04 CET 2153
Empreintes du certificat :
         MD5 : *a correct md5 hash*
         SHA1 : *a correct sha1 hash*
         SHA256 : SHA256withRSA
Nom de l'algorithme de signature : Clé RSA 2048 bits
Algorithme de clé publique du sujet : 3
Version : {10}

What should I do to get the actual Sha256 fingerprint ?

2 Answers

Take this with a grain of salt. This might be a bug in keytool for non english locales (French, German) Feel free to correct me if I'm wrong:

locale=de,system locale

keytool -list -v -keystore <pathToKeyStore>
...
Zertifikatfingerprints:
MD5: <FINGERPRINT>
SHA1: <FINGERPRINT>
SHA256: SHA256withRSA

Now in English: locale=en

LANG=C keytool -list -v -keystore <pathToKeyStore>
...
Certificate fingerprints:
SHA1: <FINGERPRINT>
SHA256: <FINGERPRINT>
Signature algorithm name: SHA256withRSA

So the second fingerprint seems to "always" be the SHA256 fingerprint, only in the two, or more, mentioned locales "keytool" has a bug in the translation. I'm not an expert on this, but this is just a visual observation.

I had the same issue using the keytool utility, however using "gradlew" directly it works.

Go to your project's app folder and run:

./gradlew signingReport

It will print all the signatures related to your app. Locate the one you are looking for (in my case, it was "release").

----------
Variant: release
Config: release
Store: ***
Alias: ***
MD5: ***
SHA1: ***
SHA-256: ***
Valid until: ***
----------
Related