I have a requirement where i need to find the APK Cert sha256 . I am able to find the SHA1 and MD5 using signing report in android studio. But i could not find SHA256 cert. How can i find that.
Asked
Active
Viewed 2,330 times
1 Answers
0
use this method:
//HashKey Generator
public static String getProjectHashKey(Context context) {
String hashKey = "";
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
context.getPackageName(),
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
hashKey = Base64.encodeToString(md.digest(), Base64.DEFAULT);
Log.d("KeyHash:", hashKey);
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return hashKey;
}

jake oliver
- 118
- 1
- 6