I just did this for Branch.io and Firebase. This is exactly what gave me my MD5, SHA1 and SHA256:
If on Windows, navigate to the folder where your keystore is. Hold down shift then right click. You should see "Open Command Prompt Here" in the list of options.
When command prompt opens, type the following and you will get everything you need:
keytool -list -v -keystore {yourkeystore}
Then it will ask for the password. Enter your password and hit enter. Then you will have all of your needed info.
SIDE NOTE
If you want to save the information for future use, right click and choose select all. Hit enter and then paste in your favorite text editor. Save it with your keystore so that you always have the reference in case you need it for other sdk's/api's. Hope that helps.
If on Windows
Hold down Windows Home key and hit "X". Select "System" Then select "Advanced System Settings" on the left hand side. In the popup, click environment variables. Under the System Variables section look for "JAVA HOME" if not there, click new. Type JAVA_HOME for variable name. Enter the following for the variable value:
C:\\Program Files\\Java\\jdk1.8.0_66
Make sure that matches the JDK version you have
Then look for the "Path" variable and add:
C:\\Program Files\\Java\\jre7\\bin
Make sure those match the locations for your Java SDK and Runtime environments. Then you will be able to access keytool from anywhere via the command prompt.
I think you are mixing up two separate commands by including both -exportcert
and -list
. I think -exportcert
is the one you want. According to man keytool
:
-exportcert
{-alias alias} {-file cert_file} {-storetype storetype} {-keystore keystore}
[-storepass storepass] {-providerName provider_name}
{-providerClass provider_class_name {-providerArg provider_arg}}
{-rfc} {-v} {-protected} {-Jjavaoption}
Reads from the keystore the certificate associated with alias and stores it in the
cert_file file. When no file is specified, the certificate is output to stdout.
The certificate is by default output in binary encoding. If the -rfc option is
specified, then the output in the printable encoding format defined by the Internet
RFC 1421 Certificate Encoding Standard.
If alias refers to a trusted certificate, then that certificate is output.
Otherwise, alias refers to a key entry with an associated certificate chain. In
that case, the first certificate in the chain is returned. This certificate
authenticates the public key of the entity addressed by alias.
This command was named -export in earlier releases. The old name is still supported
in this release. The new name, -exportcert, is preferred going forward.
Although the documentation for -list
immediately follows, it is a separate command for listing info about the certificate without actually making any changes, exporting anything, etc.
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.