Getting fingerprint for Android keystore certificate on Mac

故事扮演 提交于 2020-01-06 04:46:48

问题


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.

What's the correct command on a Mac?


回答1:


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

It adds the default password android already in the command which saves one from typing. I hope Google will fix the documentation.

Output should look like:

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".

Credit: @JoeNCA https://stackoverflow.com/a/28350434/7483211



来源:https://stackoverflow.com/questions/59505659/getting-fingerprint-for-android-keystore-certificate-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!