I am trying to get the key hash for a release keystore.
Tried below two methods which gives different key's but none works.
Method 1:
// Add code to print out the key hash
try {
PackageInfo info = getPackageManager().getPackageInfo(
<MYPACKAGE>,
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Method 2:
On Windows, use:
keytool -exportcert -alias <mykeystorelias> -keystore <keystorepath> | openssl sha1 -binary | openssl base64
But method 1 worked for the debug keystore.
- The release keystore was created by me from eclipse and don't have an extention to the name.
- it asks for the password when I used method 2