Reputation: 1257
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.
Upvotes: 20
Views: 22767
Reputation: 1104
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)
Upvotes: 0
Reputation: 1443
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.
Upvotes: 18
Reputation: 5325
This can also be done with OpenSSL:
openssl pkcs12 -in <my pkcs12 file>.p12 -nodes -passin pass:<passphrase, or blank> |openssl x509 -noout -fingerprint
Upvotes: 26