1
votes

So here is my problem.

When i run keytool to get the hash key it will give me the ; openssl is not a valid command, program etc.

I have installed openssl and the path is: C:\Program Files (x86)\GnuWin32\bin\openssl

Is that wrong?

How should i write the commandline?

I try to write it like this:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

Doesnt work so i try like this:

keytool -exportcert -alias androiddebugkey -keystore c:\Users\Richie.android\debug.keystore | openssl sha1 -binary | openssl base64

Doesnt work....

should i specify the path to openssl or what should i do?

I´ve tried it in Cygwin also but i dont even got keytools to operate there ´cuase i dont know how to go to the right folder ( program files (x86)\Java\jre6\bin)

Any ideas? I´m dying here....

3
how about pasting the error message instead of saying "doesn't work"?jcomeau_ictx

3 Answers

1
votes

Hi Richie you have to write the path where is located your keystore and the openssl folder, this is the way i do...

I have installed OpenSSL in ::

C:\openssl

the path and name of my Keystore is ::

C:\android\gruporeforma.keystore

So this is what i write in the commandline ::

keytool -exportcert -alias gruporeforma -keystore "C:\android\gruporeforma.keystore" | c:\openssl\bin\openssl sha1 -binary | c:\openssl\bin\openssl enc -a -e

0
votes

yes, you need to specify the path to openssl and keytool unless they're already in your PATH. the first command should work in Cygwin as typed, and if it doesn't you need to install the correct packages. or just continue with Windows, specifying the full path to each executable.

0
votes

better use this piece of code

  try {
        PackageInfo info = getPackageManager().getPackageInfo("your.package",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("YOURHASH KEY:",
                    Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }