Openssl is not recognized as an internal or external command

Viewed 261761

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?

22 Answers

IDK if this is relevant here, but if you have Git Installed, you can find the openssl in the "C:\Program Files\Git\usr\bin" and that location you can use in the Terminal for your Keystore Command.

oh and yeah the command:

keytool -exportcert -alias keystore -keystore "C:\Users\YOURPATH/filename.jks" | "C:\Program Files\Git\usr\bin\openssl" sha1 -binary | "C:\Program Files\Git\usr\bin\openssl" base64

use this worked for me. please change your Path

C:\Program Files\Java\jre7\bin keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Ace.android\debug.keystore" | "C:\openssl\bin

\openssl.exe" sha1 -binary | "C:\openssl\bin\openssl.exe" base64

For those who arrive lost as I was now, follow Usama Sarwar response but if:

"your_openssl_path/bin/openssl.exe"

doesn't work, try it

your_openssl_path/bin/openssl.exe.

Without the quotes.

"c:\openssl\bin\openssl.exe" => Didn't work for me

c:\openssl\bin\openssl.exe => Worked for me

I've got the same issue today, solved it by following this video (the SSL installation) - https://www.youtube.com/watch?v=PoAc1lpfK8I&ab_channel=GleyGames

Then, i've took Usamas command, and run it (after changing the paths in the command), I've run it FROM inside the bin folder inside the java installation, using CMD.

full command that worked for me:

(from inside C:\Program Files\Java\jdk-11.0.12\bin) :

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "C:\Program Files\OpenSSL-Win64\bin\openssl" sha1 -binary | "C:\Program Files\OpenSSL-Win64\bin\openssl" base64

Step 1

Download SSL for windows at https://code.google.com/archive/p/openssl-for-windows/downloads.

Step 2

Unzip the folder to OpenSSL and paste it to "C:\Program Files".

Step 3

Add "C:\Program Files\OpenSSL\bin" to your environnement variables (Edit the system environnement variables > Environnement variables > Path > New). It will make openssl work in the terminal.

Step 4

Add "C:\Program Files\Android\Android Studio\jre\bin" to your environnement variables. It will make keytool work in the terminal.

Step 5

Open a terminal and execute :

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

The password should be android.

use this

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | "C:\Users\DK\openssl-0.9.8d_X64\bin\openssl.exe" sha1 -binary | "C:\Users\DK\openssl-0.9.8d_X64\bin\openssl.exe" base64

Easy solution if you have git installed locally. you can just open git bash, change directory where you want your keys will be generated and then run your command. it will work because git installs open ssl exe by default and your don't need to set path to your ssl exe manually each time you want to run it. it works for me and I hope it helps.

If you are on windows and if you have git installed then you can run the open ssl command using GIT Bash.

  1. go to the directory where you want to store the key

  2. Right-click and open the GIT Bash

  3. Here you can run any openssl command. e.g.

    openssl enc -aes-128-cbc -k test -P -md sha1

Related