Programing

Openssl은 내부 또는 외부 명령으로 인식되지 않습니다

crosscheck 2020. 5. 26. 19:44
반응형

Openssl은 내부 또는 외부 명령으로 인식되지 않습니다


나중에 Facebook과 통합 될 앱의 응용 프로그램 서명을 생성하고 싶습니다. Facebook 자습서 중 하나에서 다음 명령을 찾았습니다.

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

이 튜토리얼에서는이 cmd를 실행하면 서명 생성 프로세스가 시작됩니다.

그러나이 명령은 오류를 제공합니다.

openssl is not recognized as an internal or external command

이걸 어떻게 제거 할 수 있습니까?


openssl 대신 ... 실제로 다운로드 한 openssl 폴더의 경로를 지정해야합니다. 실제 명령은 다음과 같아야합니다.

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

입력 할 경로는 openssl을 설치 한 경로 일 것입니다. 도움이 되길 바랍니다 .. :-)

편집하다:

아래의 각 링크에서 windows 32 및 64 비트 용 openssl을 다운로드 할 수 있습니다.

64 비트 용 OpenSSL

32 비트 용 OpenSSL


다음과 같이 전체 경로를 사용하십시오.

exportcert -alias androiddebugkey -keystore ~/.android
/debug.keystore | "C:\openssl\bin\openssl.exe" sha1 -binary | "C:\openssl\bin\op
enssl.exe" base64

그것은 나를 위해 일했다.


다음 단계를 따르십시오. 키가 올바르게 작동하기를 바랍니다.

  1. 1 단계 OpenSSL이 필요합니다. Google 코드의 openssl-for-windows 프로젝트에서 바이너리를 다운로드 할 수 있습니다 .

  2. 2 단계 폴더의 압축을 풀고 폴더의 경로를 bin클립 보드에 복사합니다.

    예를 들어, 파일이 위치에 압축이 풀린 C:\Users\gaurav\openssl-0.9.8k_WIN32경우 경로를 복사하십시오 C:\Users\gaurav\openssl-0.9.8k_WIN32\bin.

  3. 3 단계 시스템 환경 경로에 경로를 추가합니다. PATH환경 변수가 설정된 cmd를 열고 다음 명령을 입력하십시오.

    C:\>keytool -exportcert -alias androiddebugkey -keystore [path to debug.keystore] | openssl sha1 -binary | openssl base64
    

    프롬프트가 표시되면 비밀번호를 입력하십시오. 명령이 작동하면 키가 표시됩니다.


이것은 나를 위해 성공적으로 작동했습니다.

"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

아래 경로에주의하십시오 :

  • "C : \ Program Files \ Java \ jdk1.6.0_26 \ bin \ keytool.exe"
  • "D : \ keystore \ SocialListing" 또는 " C : \ Users \ Shaon.android \ debug.keystore " 와 같을 수 있습니다 .
  • "C : \ cygwin \ bin \ openssl.exe" 또는 다음과 같을 수 있습니다 : C : \ Users \ openssl \ bin \ openssl.exe

명령이 성공적으로 작동하면 다음 명령이 표시됩니다.

키 저장소 비밀번호 입력 : typeyourpassword

암호화 된 해시 키 **


답변이 늦었지만 나와 같은 사람들을 게으르게하는 데 도움이 될 것입니다.이 코드를 응용 프로그램 클래스에 추가하고 openssl을 다운로드 할 필요가 없으며 경로를 설정할 필요가 없습니다.이 코드 만 복사하면됩니다. 로그에 생성됩니다.

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);
        }
    }
}

매니페스트에 MyApplication 클래스를 추가하는 것을 잊지 마십시오.

<application
        android:name=".MyApplication"
</application>

먼저 cmd cd c : \ Program Files (x86) \ Java \ jre7 \ bin에서 Java / jre / bin 폴더로 이동하십시오.

그런 다음 : [시스템의 올바른 위치로 debug.keystore 경로 변경] openssl 설치 (c : \ openssl의 필요에 따라 Windows 32 또는 64)

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\vibhor\.android\debug.keystore" | "c:\openssl\bin\openssl.exe" sha1 -binary | "c:\openssl\bin\openssl.exe" base64

따라서 전체 명령은 다음과 같습니다. [실행시 키 저장소 비밀번호를 입력하라는 프롬프트]

c:\Program Files (x86)\Java\jre7\bin>keytool -exportcert -alias androiddebugkey
-keystore "C:\Users\vibhor\.android\debug.keystore" | "c:\openssl\bin\openssl.ex
e" sha1 -binary | "c:\openssl\bin\openssl.exe" base64
Enter keystore password:

Steps to create Hash Key. 
1: Download openssl from Openssl for Windows . I downloaded the Win64 version 
2:Unzip and copy all the files in the bin folder including openssl.exe(All file of bin folder) 
3:Goto to the folder where you installed JDK for me it’s C:\Program Files\Java\jdk1.8.0_05\bin 
4:Paste all the files you copied from Openssl’s bin folder to the Jdk folder. 

그런 다음 C : \ Program Files \ Java \ jdk1.8.0_05 \ bin으로 이동하고 Shift 키를 누르고 마우스 오른쪽 버튼을 클릭하고 cmd를 엽니 다.

C:\Program Files\Java\jdk1.8.0_05\bin>//cmd path 

that is for Sha1 past this
keytool -exportcert -alias androiddebugkey -keystore "C:\User\ABC\.android.keystore" | openssl sha1 -binary | openssl base64
//and ABC is system name put own system name


I used this code:

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

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


Downloads and Unzip

You can download openssl for windows 32 and 64 bit from the respective links below:

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

OpenSSL for 64 Bits OpenSSL for 32 Bits

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | **"C:\Users\keshav.gera\openssl-0.9.8k_X64\bin**\openssl.exe" sha1 -binary | **"C:\Users\keshav.gera\openssl-0.9.8k_X64\bin**\openssl.exe" base64

Important change our path Here as well as install open ssl in your system

It's Working No Doubt

C:\Users\keshav.gera>keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | "C:\Users\keshav.gera\openssl-0.9.8k_X64\bin\openssl.exe" sha1 -binary | "C:\Users\keshav.gera\openssl-0.9.8k_X64\bin\openssl.exe" base64

Enter keystore password: android

**ZrRtxw36xWNYL+h3aJdcCeQQxi0=**

=============================================================

using Manually through Coding

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


private void PrintHashKey() {

        try {
            PackageInfo info = getPackageManager().getPackageInfo("**com.keshav.patanjalidemo  Your Package Name Here**", PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");        
                md.update(signature.toByteArray());
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }

    }

For those looking for a more recent location to install a windows binary version of openssl (32bit and 64bit) you can find it here:

http://slproweb.com/products/Win32OpenSSL.html

An up to date list of websites that offer binary distributions is here

http://www.openssl.org/related/binaries.html


go to bin folder path in cmd and then run following command

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

you will get your key hash


for windows users download open ssl from google's code repository https://code.google.com/p/openssl-for-windows/downloads/list

After the download, extract the contents to a folder preferably in your c: drive.

Then update your PATH environment variable so you can use the .exe from any location in your command line.

[windows 8] To update your PATH environment variable, click my computer->properties->Advanced System Settings.

Click the Advanced Tab and click the 'Environment Variable' button at the bottom of the dialog then select the Path entry from the 'System Variables' Section by clicking edit.

Paste the path to the bin folder of the extracted openssl download and click ok.

You will need to close and open and command prompt you may have previously launched so that you can load the updated path settings.

Now run this command:

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Oladipo.android\debug.keystore" | openssl sha1 -binary | openssl base64

You should see the developer key.


This works for me:

C:\Users\example>keytool -exportcert -alias androiddebugkey -keystore 
"C:\Users\example\.android" | "C:\openssl\bin\openssl.exe" sha1 -binary 
| "C:\openssl\bin\oenssl.exe" base64

It is not guaranteed that generating hashkey with this single openssl method will work. If it does not work for me. But thanks for giving me a direction to solve my issue.

Guaranteed Solution : You need to break the whole command in separate commands and have to write output of every execution in file.

You can take the help from the following link :

http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1

Enjoy :)

참고URL : https://stackoverflow.com/questions/11896304/openssl-is-not-recognized-as-an-internal-or-external-command

반응형