简体   繁体   中英

How to get SHA1 fingerprints from p12 certificate?

In order to get the keys of my Android project, Google requires SHA1 fingerprint. Offered this command: keytool-list-v-keystore mystore.keystore

I went through different options, but always in an error Illegal option: Files keytool:-list [OPTION] ...

For example my command:

C:\Program Files (x86)\Java\jre7\bin>keytool -storepass mypass -list -v -keystore C:\Program Files (x86)\Java\jre7\bin\android.p12

If i set p12 file in root (c:) then i get another error - Invalid keystore format.

这也可以通过OpenSSL完成:

openssl pkcs12 -in <my pkcs12 file>.p12 -nodes -passin pass:<passphrase, or blank> |openssl x509 -noout -fingerprint

For p12 format (PKCS12) use option -storetype PKCS12 .

For example:

keytool -list -v -keystore mykeystore.p12 -storetype PKCS12 -storepass 123456

For keystore/certificate inspection & manipulation i recommend GUI tool Portecle (formerly: KeyToolGUI). Here is convenient windows installer.

If you are using Android Studio . You can get fastly the SHA1 certificate fingerprint ( debug,release... all Build Types!! ) through Gradle Tasks:

signingReport

SHA1 is shown in Messages Logs

Android Plugin (configured in the gradle app) creates a debug mode for default . File route to keystore: HOME/.android/debug.keystore

I recommend attach debug.keystore to build.gradle. To do this put a file debug.keystore to a app folder.

Extra: If you want creates for release, put a file release.keystore to a app folder. (This example uses the same debug.keystore)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM