如何在 Android 上获取 OAuth 2.0 的签名证书指纹 (SHA1)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12214467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?
提问by Alex
I'm trying to register my android app following the steps in https://developers.google.com/console/help/#installed_applicationswhich leads me to follow http://developer.android.com/tools/publishing/app-signing.html.
我正在尝试按照https://developers.google.com/console/help/#installed_applications中的步骤注册我的 android 应用程序, 这导致我关注 http://developer.android.com/tools/publishing/app-签名.html。
However, I'm not sure how to get the signing certificate fingerprint (SHA1).
但是,我不确定如何获取签名证书指纹(SHA1)。
I first used the Eclipse ADT plugin to export and create the keystore/key.
Then, I tried doing keytool -list keystore mykeystore.keystore
and it gives me a MD5 Certificate fingerprint. Do I need to redo the signing (meaning I can't use the eclipse export wizard)?
我首先使用 Eclipse ADT 插件来导出和创建密钥库/密钥。然后,我尝试这样做keytool -list keystore mykeystore.keystore
,它给了我一个 MD5 证书指纹。我是否需要重做签名(意味着我不能使用 eclipse 导出向导)?
Can I use a debug certificate first?
我可以先使用调试证书吗?
回答by Frederick Nyawaya
Start an export process to create an apk for your app and use your production key. The very last page displays both your SHA1 and MD5 certificate fingerprints
启动导出过程,为您的应用创建 apk 并使用您的生产密钥。最后一页显示您的 SHA1 和 MD5 证书指纹
回答by Nick
I know this question has been answered but this is how I found my signature for the default keystore. In Eclipse, if you go to Windows -> Preferences -> Android -> Build
我知道这个问题已经得到解答,但这就是我找到默认密钥库签名的方式。在 Eclipse 中,如果你去 Windows -> Preferences -> Android -> Build
回答by Ravi
I think this will work perfectly. I used the same:
我认为这将完美地工作。我用了同样的:
For Android Studio:
对于安卓工作室:
- Click on Build> Generate Signed APK.
- You will get a message box, just click OK.
- Now there will be another window just copy Key Store Path.
- Now open a command prompt and go to C:\Program Files\Java\jdk1.6.0_39\bin>(or any installed jdk version).
- Type keytool -list -v -keystoreand then paste your Key Store Path(Eg. C:\Program Files\Java\jdk1.6.0_39\bin>keytool -list -v -keystore "E:\My Projects \Android\android studio\signed apks\Hello World\HelloWorld.jks").
- Now it will Ask Key Store Password, provide yours and press Enterto get your SHA1 and MD5 Certificate keys.
- 单击Build> Generate Signed APK。
- 您将收到一个消息框,只需单击“确定”即可。
- 现在将出现另一个窗口,只需复制Key Store Path 即可。
- 现在打开命令提示符并转到C:\Program Files\Java\jdk1.6.0_39\bin>(或任何已安装的 jdk 版本)。
- 键入keytool -list -v -keystore然后粘贴您的密钥存储路径(例如 C:\Program Files\Java\jdk1.6.0_39\bin>keytool -list -v -keystore "E:\My Projects\Android\android工作室\签名的 apks\Hello World\HelloWorld.jks”)。
- 现在它将询问密钥存储密码,提供您的密码并按下Enter以获取您的 SHA1 和 MD5 证书密钥。
回答by Randy Sugianto 'Yuku'
If you are using Mac or even Linux, just copy and paste this onto the Terminalapplication and you will get the SHA1 key immediately. No need to change anything.
如果您使用的是 Mac 甚至 Linux,只需将其复制并粘贴到终端应用程序上,您将立即获得 SHA1 密钥。不需要改变任何东西。
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Example output:
示例输出:
Alias name: androiddebugkey
Creation date: 17 Feb 12
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 4f3dfc69
Valid from: Fri Feb 17 15:06:17 SGT 2012 until: Sun Feb 09 15:06:17 SGT 2042
Certificate fingerprints:
MD5: 11:10:11:11:11:11:11:11:11:11:11:11:11:11:11:11
SHA1: 11:11:11:11:11:11:11:11:11:11:11:11:11:11:11:11:11:11:01:11
Signature algorithm name: SHA1withRSA
Version: 3
回答by Dan Jurgen
use this in the command line
在命令行中使用它
c:\Program Files\Java\jdk1.6.25\bin>keytool -list -v -keystore c:\you_key_here.key
回答by gurkan
Open terminal (in Unix, in MAC), (cmd
in Windows) and cd
to this (your java) path:
打开终端(在Unix 中,在MAC 中),(cmd
在Windows 中)和cd
这个(你的 java)路径:
C:\Program Files\Java\jdk1.6.0_43\bin>
Run this command:
运行此命令:
keytool -list -v -keystore C:\Users\leon\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
Just change the path to debug.keystore
and you will get both MD5 and SHA-1 fingerprints.
只需将路径更改为debug.keystore
,您将同时获得 MD5 和 SHA-1 指纹。
回答by Manmohan Soni
keytool -list -v -keystore "keyStoreName"
Run this command from the directory where the keystore of your app exists.
从应用程序密钥库所在的目录运行此命令。
回答by Harunduet
回答by Akshay
See if you want to use Google Map
at that time you need MD5
fingerprint for generating api kay
for using google map in your android application.
看看你Google Map
当时是否想使用你需要MD5
指纹来生成api kay
在你的android应用程序中使用谷歌地图。
Keytool command generated MD5
fingerprint if you use JDK 1.6
and it generates SHA1
fingerprint if you use JDK 1.7
.
Keytool 命令生成MD5
指纹,如果你使用JDK 1.6
,它会生成SHA1
指纹,如果你使用JDK 1.7
.
So the thing is that if you want to sign your application for publishing then read this.
所以问题是,如果您想签署您的应用程序以进行发布,请阅读此.
And if you want to use google-map
read this.
如果你想使用google-map
阅读这个.
回答by Vinod Joshi
If any one using the Android studio...
如果有人使用 Android 工作室...
click: Build > Generate Signed in APK Create a new key: this will generated ".jks" files
单击:Build > Generate Signed in APK 创建一个新密钥:这将生成“.jks”文件
Use following command to read the data(SHA1 and other info):
使用以下命令读取数据(SHA1 和其他信息):
$ keytool -list -v -keystore filename.jks
$ keytool -list -v -keystore 文件名.jks