Openssl is not recognized as an internal or external command
Solution 1
Well at the place of OpenSSL ... you have to put actually the path to your OpenSSL folder that you have downloaded. Your actual command should look like this:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | "C:\Users\abc\openssl\bin\openssl.exe" sha1 -binary | "C:\Users\abc\openssl\bin\openssl.exe" base64
Remember, the path that you will enter will be the path where you have installed the OpenSSL.
Edit:
you can download OpenSSL for windows 32 and 64 bit from the respective links below:
Solution 2
Please follow these step, I hope your key working properly:
Step 1 You will need OpenSSL. You can download the binary from openssl-for-windows project on Google Code.
-
Step 2 Unzip the folder, then copy the path to the
bin
folder to the clipboard.For example, if the file is unzipped to the location
C:\Users\gaurav\openssl-0.9.8k_WIN32
, then copy the pathC:\Users\gaurav\openssl-0.9.8k_WIN32\bin
. -
Step 3 Add the path to your system environment path. After your
PATH
environment variable is set, open the cmd and type this command:C:\>keytool -exportcert -alias androiddebugkey -keystore [path to debug.keystore] | openssl sha1 -binary | openssl base64
Type your password when prompted. If the command works, then you will be shown a key.
Solution 3
Use the entire path, like this:
exportcert -alias androiddebugkey -keystore ~/.android
/debug.keystore | "C:\openssl\bin\openssl.exe" sha1 -binary | "C:\openssl\bin\op
enssl.exe" base64
It worked for me.
Solution 4
This is worked for me successfully.
"C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe" -exportcert -alias sociallisting -keystore "D:\keystore\SocialListing" | "C:\cygwin\bin\openssl.exe" sha1 -binary | "C:\cygwin\bin\openssl.exe" base64
Be careful with below path :
- "C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe"
- "D:\keystore\SocialListing" or it can be like this "C:\Users\Shaon.android\debug.keystore"
- "C:\cygwin\bin\openssl.exe" or can be like this C:\Users\openssl\bin\openssl.exe
If command successfully work then you will see this command :
Enter keystore password : typeyourpassword
Encryptedhashkey**
Solution 5
it's late answer but it will help to lazy people like me.. add this code to your Application class, there is no need to download openssl and no need to set the path.. only need is just copy this code.. and keyHash will generated in log.
import com.facebook.FacebookSdk;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
printKeyHash();
}
private void printKeyHash() {
try {
PackageInfo info = getPackageManager().getPackageInfo(
getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("KeyHash:",
Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (PackageManager.NameNotFoundException e) {
Log.e("jk", "Exception(NameNotFoundException) : " + e);
} catch (NoSuchAlgorithmException e) {
Log.e("mkm", "Exception(NoSuchAlgorithmException) : " + e);
}
}
}
and do not forget add MyApplication class in manifest:
<application
android:name=".MyApplication"
</application>
Related videos on Youtube
Khurram W. Malik
Updated on July 08, 2022Comments
-
Khurram W. Malik almost 2 years
I wish to generate an application signature for my app which will later be integrated with Facebook. In one of Facebook's tutorials, I found this command:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
In the tutorial, it says that by running this cmd, my process of generating the signature will start.
However, this command gives an error:
openssl is not recognized as an internal or external command
How can I get rid of this?
-
Michael Petrotta over 11 yearsDownload and install OpenSSL.
-
Khurram W. Malik over 11 yearsI downloaded 3 of them no one is compatible :/
-
Michael Petrotta over 11 yearsWhat does that mean, khurram?
-
Khurram W. Malik over 11 yearsI downloaded many versions of openssl from the link u gave but each of them gives an error before installation that it isnt compatible with windows 7- 64 bit. Can you tell me the exact openssl i require
-
Usama Sarwar over 11 yearsyou can get it from the link I have posted in my ans below...
-
RBT over 2 yearsRelated post - How to install OpenSSL in windows 10?
-
-
Akhil Jain about 11 yearsit says c:\openssl\bin\openssl is not recognized
-
AnhSirk Dasarp over 10 yearsa better way would be to execute the original command from openssl/bin directory. I.e if my openssl directory is in C:dev, I would move to C:\dev\openssl\bin, and execute the command as it is
-
phanhongphucit over 10 yearsyou should point out the openssl.exe file: exportcert -alias androiddebugkey -keystore ~/.android /debug.keystore | "C:\openssl\bin\openssl.exe" sha1 -binary | "C:\openssl\bin\op enssl.exe" base64
-
surhidamatya over 10 years@LatentBoy yess you are right. your way worked for me. Thanks alot.
-
Azahar over 10 yearsmust download openssl from here code.google.com/p/openssl-for-windows/downloads/… and copy bin folder and paste to C:\openssl\
-
Krupal Shah over 9 yearsthanks...after trying about an hour, your answer worked for me
-
Harsha over 9 yearscan you suggest openssl for windows32bit plse
-
Usama Sarwar over 9 years@Harsha Please see the edit section, now it has got OPenSSL link for 32 bits as well.
-
PAA over 7 yearsUsama : Could you please guide on the issue stackoverflow.com/questions/38935267/… ?
-
Neon Warge over 7 yearsThe download links available seems to be source files and so it doesn't contain binary files which I believe I may have to build myself out of the box. Where can I get the official binary files?
-
Jaime Montoya about 7 yearsIt should be something like this: C:\Program Files\Java\jre1.8.0_111\bin>keytool -exportcert -alias androiddebugkey -keystore C:\Users\jaimemontoya\.android\debug.keystore | "C:\Program Files (x86)\GnuWin32\bin\openssl.exe" sha1 -binary | "C:\Program Files (x86)\GnuWin32\bin\openssl.exe" base64
-
MetaSnarf about 7 yearsdoes this work for release version of facebook? if not how?
-
Sagar Chavada about 7 yearsThis code is used to generate keyhash. And its same key for release too. For release version make sure that you set public access in facebook developer console.
-
Ionut over 6 yearsWhat
bin
folder are you refering to in the second step? -
ralphgabb over 6 years'"C:\OpenSSL\bin.openssl.exe"' is not recognized as an internal or external command, operable program or batch file.
-
Someone Somewhere over 5 yearsFYI: Usually the debug.keystore password is just "android".
-
Someone Somewhere over 5 yearsFYI: Usually the debug.keystore password is just "android".
-
Yesha Shah over 5 yearsGetting error " Both context and applicationId must be non-null", when used above code. @SagarChavada
-
Narendra_Nath over 2 yearsThis worked.. Thank you
-
Paul Grei over 2 yearsRemove double quotes and it will work :) like so : keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | C:\openssl\bin\openssl.exe sha1 -binary | C:\openssl\bin\openssl.exe base64
-
Devendra Singraul over 2 yearsIt is good idea to add path in system environment variable