0

when I run keytool in cmd to generate a hash key for facebook api, I get this

C:\Program Files\Java\jre7\bin>keytool -exportcert -alias androiddebugkey -keystore "C:\Loay\Ravi\.android\debug.keystore" | openssl sha1 -binary | openssl base
64
'openssl' is not recognized as an internal or external command,
operable program or batch file.

I have openssl installed

Lal
  • 14,726
  • 4
  • 45
  • 70
ljdayekh
  • 95
  • 1
  • 10
  • you can use my tools for mac and windows to generate keyhash here: http://stackoverflow.com/a/17732453/2226605 – Shahar May 08 '14 at 13:58

2 Answers2

1

I can't remember for the life of me where I got this from years ago to give proper credit, but why not have the app tell you:

@SuppressLint("NewApi")
public static void getApplicationSignature(Activity activity){
    try {
        PackageInfo info = activity.getPackageManager().getPackageInfo("your.package.name.here", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.e("MY KEY HASH:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }
}

Just be sure to replace "your.package.name.here" with your root package name.

Edit: But if you want to go the openSSL route, TDMaster's answer about adding it to your Path variable is the solution you want. Just kinda thought I'd throw this one out there too.

Cruceo
  • 6,763
  • 2
  • 31
  • 52
0

Add the OpenSSL Path to your computer Variables

Instractions

or copy the openssl to the same location of the keytool