Skip to content

Instantly share code, notes, and snippets.

@iraycd
Created April 9, 2015 22:13
Show Gist options
  • Save iraycd/07c9a8b6376dcc4bce33 to your computer and use it in GitHub Desktop.
Save iraycd/07c9a8b6376dcc4bce33 to your computer and use it in GitHub Desktop.
Key Store Validation
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.facebook.samples.hellofacebook",
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) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment