如何使用Java 10获得SHA 1证书?

时间:2018-06-27 08:29:18

标签: android sha1 android-debug java-10

我正在尝试借助此link获得SHA 1证书,但在JAVA 10中却没有得到所需的结果。

keytool -exportcert -list -v \
-alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore

错误:**keytool error: java.lang.Exception: Only one command is allowed: both -exportcert and -list were specified.**

keytool -exportcert -v \ -alias androiddebug -keystore C:\Users\Tushar Rai\.android\debug.keystore

输出 **

Exports certificate
Options:
 -rfc                    output in RFC style
 -alias <alias>          alias name of the entry to process
 -file <file>            output file name
 -keystore <keystore>    keystore name
 -cacerts                access the cacerts keystore
 -storepass <arg>        keystore password
 -storetype <type>       keystore type
 -providername <name>    provider name
 -addprovider <name>     add security provider by name (e.g. SunPKCS11)
   [-providerarg <arg>]    configure argument for -addprovider
 -providerclass <class>  add security provider by fully-qualified class name
   [-providerarg <arg>]    configure argument for -providerclass
 -providerpath <list>    provider classpath
 -v                      verbose output
 -protected              password through protected mechanism
Use "keytool -help" for all available commands

这是尝试输入SHA1证书命令后的输出

C:\Program Files\Java\jdk-10.0.1\bin>keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Tushar Rai\.android\debug.keystore" -v
Enter keystore password:

*****************  WARNING WARNING WARNING  *****************
* The integrity of the information stored in your keystore  *
* has NOT been verified!  In order to verify its integrity, *
* you must provide your keystore password.                  *
*****************  WARNING WARNING WARNING  *****************

Android Debug10U
Android Debug10UU0
 üì 0üëüü íl°╧⌠zlù¢Güƒ0
╒g"$$°pca╔Θ!╕à]╛╚Hó[≤¡└Γê2┴╘░ªG┐ùÖ_5?7B¥K╘-£┤∞eΓ0╜┴òÄ┘ìPpPu┘m⌐δ9}Ys°Ii┘■2£τ╘c½█óR║$1xeφⁿh
 üü ô╕rV┼∩╬o╥ΣAL┐─Q╥P^d6¥ì╚kèÄí^▒K┬+ÇmPUNφ▄⌐!á8GpÄd═y²rûNú'╠x÷|┴}ê`─╬äé_▄6╚╙ìƒÆgZσⁿMS╩½Äv]µ}÷      îh┌|ä ┐ézV9?╠Åδ!τ┤|U╪²û╬fm╦⌠
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 C:\Users\Tushar Rai\.android\debug.keystore -destkeystore C:\Users\Tushar Rai\.android\debug.keystore -deststoretype pkcs12".

**

2 个答案:

答案 0 :(得分:0)

我认为问题出在用户名“因为它包含空格” 尝试使用此命令

 c:\>which which
/c/prg_sdk/ruby/dev_kit/bin/which

编辑: 这个命令为他工作了

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Tushar Rai\.android\debug.keystore" -list -v

答案 1 :(得分:0)

获取释放密钥:

keytool -list -v -keystore C:\ Users \ MG \ Desktop \ test.jks -alias测试