【发布时间】:2017-08-05 12:52:33
【问题描述】:
【问题讨论】:
-
不要在您的问题中发布图片。只需复制并粘贴信息,以便当 imgur 或您使用的任何主机清除图像时,该问题对未来的读者仍然有意义。
标签: android firebase sha1 keytool
【问题讨论】:
标签: android firebase sha1 keytool
我刚刚为 Branch.io 和 Firebase 做了这个。这正是我的 MD5、SHA1 和 SHA256:
如果在 Windows 上,请导航到您的密钥库所在的文件夹。按住 shift 然后右键单击。您应该会在选项列表中看到“在此处打开命令提示符”。
当命令提示符打开时,键入以下内容,您将获得所需的一切:
keytool -list -v -keystore {yourkeystore}
然后它会要求输入密码。输入您的密码并按回车键。然后,您将获得所有需要的信息。
旁注
如果您想保存信息以备将来使用,请右键单击并选择全选。点击回车,然后粘贴到您喜欢的文本编辑器中。将其与您的密钥库一起保存,以便在您需要其他 sdk/api 时始终拥有参考。希望对您有所帮助。
如果在 Windows 上
按住 Windows Home 键并点击“X”。选择“系统”,然后选择左侧的“高级系统设置”。在弹出窗口中,单击环境变量。在“系统变量”部分下查找“JAVA HOME”(如果不存在),单击“新建”。键入 JAVA_HOME 作为变量名。为变量值输入以下内容:
C:\Program Files\Java\jdk1.8.0_66
确保与您拥有的 JDK 版本匹配
然后查找“Path”变量并添加:
C:\Program Files\Java\jre7\bin
确保这些位置与您的 Java SDK 和运行时环境的位置相匹配。然后,您将能够通过命令提示符从任何地方访问 keytool。
【讨论】:
'keytool' is not recognized as an internal or external command, operable program or batch file. 我再次尝试在 java 文件夹中,我得到了与上面相同的结果。
我认为您通过同时包含 -exportcert 和 -list 来混淆两个单独的命令。我认为-exportcert 是您想要的。根据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.
虽然-list 的文档紧随其后,但它是一个单独的命令,用于列出有关证书的信息,而无需实际进行任何更改、导出任何内容等。
【讨论】: