32

I am trying to execute the following command in command prompt .

keytool -exportcert -alias androiddebugkey -keystore "<path-to-users-directory>\.android\debug.keystore" | openssl sha1 -binary | openssl base64

But the command prompt windows reports:

'openssl' is not recognized as internal or external command.

What ca I do to execute this command in command prompt window?

jww
  • 97,681
  • 90
  • 411
  • 885

5 Answers5

36

The error you saw means there's no such program in your %PATH% (external command) and it's also not a built-in shell command (internal command).

Install OpenSSL on your machine. You will also need to check that its installed location is in your %PATH%. By default it probably won't be. As an example, suppose OpenSSL is installed at c:\OpenSSL-Win32. The openssl binary is probably located at c:\OpenSSL-Win32\bin\openssl.exe. So you path needs to include c:\OpenSSL-Win32\bin.

Sometimes OpenSSL cannot find its configuration file on Windows. For that, see OpenSSL and error in reading openssl.conf file.


Another option is to use the full path in the command:

keytool -exportcert -alias androiddebugkey -keystore "<path-to-users-directory>\.android\debug.keystore" | ^
  c:\OpenSSL-Win32\bin\openssl.exe sha1 -binary | c:\OpenSSL-Win32\bin\openssl.exe base64

However, this still suffers the OpenSSL configuration file problem detailed at OpenSSL and error in reading openssl.conf file.

jww
  • 97,681
  • 90
  • 411
  • 885
steveayre
  • 1,075
  • 11
  • 8
29

install openssl for windows from the following link .

https://code.google.com/p/openssl-for-windows/downloads/detail?name=openssl-0.9.8k_WIN32.zip

osimer pothe
  • 2,827
  • 14
  • 54
  • 92
  • 5
    I have downloaded openssl for windows from here . https://code.google.com/p/openssl-for-windows/downloads/detail?name=openssl-0.9.8k_WIN32.zip But I dnt see any .exe file to set up . Only there are bin , lib and include folder . –  Dec 30 '13 at 11:43
  • 3
    try to download binary file of openSSL – osimer pothe Dec 30 '13 at 11:48
  • 3
    Hi, I am downloaded the openSSL zip file and extracted it but I am not able to find any .exe file. – Deepak Nov 28 '17 at 16:08
  • 5
    @Deepak bin/openssl.exe – Kai Tribble Jun 07 '19 at 20:07
21

Just you need to Add OpenSSL bin path (ex: C:\Program Files\OpenSSL-Win64\bin) to the PATH system variable as shown below:

enter image description here

Ahmed Mihoub
  • 547
  • 4
  • 6
  • 3
    If you are going the route of using the OpenSSL that comes with git bash, the bath is just `C:\Program Files\Git\usr\bin` – Carson May 26 '20 at 00:44
1
  1. Go to: https://code.google.com/archive/p/openssl-for-windows/downloads
  2. Extract file
  3. open bin/openssl.exe
tscpp
  • 1,298
  • 2
  • 12
  • 35
-8

Install openssl on your Windows machine.

KCShelby
  • 1
  • 1