I just want some confirmation.
I'm developing on windows
I'm attempting to integrate facebook into an app and the SDK documentation says I need to 'export a signature'
From here: http://developers.facebook.com/docs/guides/mobile/#android
So it says run this command:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
First I had to download openssl: OpenSSL
Now the command above, I assume should be converted to:
"C:\path\to\java\keytool" -exportcert -alias your_alias -keystore "C:\path\to\your\keystore\keystore.name" | "C:\path\to\openssl_install\bin\openssl" sha1 -binary |"C:\path\to\openssl_install\bin\openssl" base64
So once I've done this it asks for a password: (it shows the password as I'm typing it)
If I enter a correct password I get
'zR2tey1h9kqPRSW/yEYEr0ruswyD=' (changed for public)
but if I enter an incorrect password it still returns me a code in the form of
'ga0RGNYHvTR5d3SVDEfpQQAPGJ1='?
So yeah, was just looking for a confirmation that I'm doing the right thing, and this is the output expected
the best way to get your hash is by running the following code:
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
Log.e("hash key", something);
}
}
catch (NameNotFoundException e1) {
// TODO Auto-generated catch block
Log.e("name not found", e1.toString());
}
catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
Log.e("no such an algorithm", e.toString());
}
catch (Exception e){
Log.e("exception", e.toString());
}
when extracting the hash with windows cmd,git bash or cygwing terminal, the three tools give different result.
the most accurate is the code above
yes you are doing it in a right way i think.i also execute this command and put this hash in my fb app and its works properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With