在Mac上获取Android密钥库证书的指纹 [英] Getting fingerprint for Android keystore certificate on Mac
问题描述
我正在跟踪 Google教程如何设置OAuth 2.0.文档要求我在终端中使用以下命令找到调试证书指纹:
I'm following Google's tutorial on how to set up OAuth 2.0. The documentation asks me to find the debug certificate fingerprint with the following command in the terminal:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
这不起作用,出现以下错误:
This doesn't work, I get the following error:
keytool error: java.lang.Exception: Only one command is allowed: both -exportcert and -list were specified.
在Mac上正确的命令是什么?
What's the correct command on a Mac?
推荐答案
教程中提供的命令(显然)适用于Windows,但不适用于Mac.但是,这一功能在Mac上就像是一种魅力:
The command provided in the tutorial works for Windows (apparently) but not for Mac. However, this one works like a charm on Macs:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
它将在命令中添加默认密码android
,从而避免键入密码.我希望Google会修复该文档.
It adds the default password android
already in the command which saves one from typing. I hope Google will fix the documentation.
输出应如下所示:
Alias name: androiddebugkey
Creation date: 23 Nov 2019
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: C=US, O=Android, CN=Android Debug
Issuer: C=US, O=Android, CN=Android Debug
Serial number: 1
Valid from: Sat Nov 23 14:57:45 CET 2019 until: Mon Nov 15 14:57:45 CET 2049
Certificate fingerprints:
SHA1: xxxxxx
SHA256: xxxxxx
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 1
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /Users/cornelius/.android/debug.keystore -destkeystore /Users/cornelius/.android/debug.keystore -deststoretype pkcs12".
信用:@JoeNCA https://stackoverflow.com/a/28350434/7483211
Credit: @JoeNCA https://stackoverflow.com/a/28350434/7483211
这篇关于在Mac上获取Android密钥库证书的指纹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!