在http://jsfiddle.net/pL5taqp6/或Facebook API的文档中提到您应该使用keytool命令,例如: G:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
但是当您将其粘贴到终端时,您只能看到错误:
Unrecognized command: -exportcert
Usage: keytool [COMMAND] [-- COMMAND]...
Manage private keys and public certificates.
Available commands:
-genkey Generate a Key Entry, eventually creating a key store.
[-alias ALIAS] [-keyalg ALGORITHM] [-keysize KEY_SIZE]
[-sigalg ALGORITHM] [-dname NAME] [-keypass PASSWORD]
[-validity DAY_COUNT] [-storetype STORE_TYPE]
[-keystore URL] [-storepass PASSWORD]
[-provider PROVIDER_CLASS_NAME] [-v].
-import Add Key Entries and Trusted Certificates.
[-alias ALIAS] [-file FILE] [-keypass PASSWORD]
[-noprompt] [-trustcacerts] [-storetype STORE_TYPE]
[-keystore URL] [-storepass PASSWORD]
[-provider PROVIDER_CLASS_NAME] [-v].
-selfcert Generate a self-signed Trusted Certificate.
[-alias ALIAS] [-sigalg ALGORITHM] [-dname NAME]
[-validity DAY_COUNT] [-keypass PASSWORD]
[-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
-identitydb NOT IMPLEMENTED YET. Import JDK1.1 Identity Database.
[-file FILE] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
-certreq Issue a Certificate Signing Request (CSR).
[-alias ALIAS] [-sigalg ALGORITHM] [-file FILE]
[-keypass PASSWORD] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v]
[-attributes].
-export Export a Certificate from a key store.
[-alias ALIAS] [-file FILE] [-storetype STORE_TYPE]
[-keystore URL] [-storepass PASSWORD]
[-provider PROVIDER_CLASS_NAME] [-rfc] [-v].
-list Print one or all Certificates in a key store to STDOUT.
[-alias ALIAS] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME]
[-rfc] [-v].
-printcert Print a human-readable form of a Certificate in a FILE.
[-file FILE] [-v].
-keyclone Clone a Key Entry in a key store.
[-alias ALIAS] [-dest ALIAS] [-keypass PASSWORD]
[-new PASSWORD] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
-storepasswd Change the password protecting a key store.
[-new PASSWORD] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
-keypasswd Change the password protecting a Key Entry in a key store.
[-alias ALIAS] [-keypass PASSWORD] [-new PASSWORD]
[-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
-delete Delete a Key Entry or a Trusted Certificate from a key store.
[-alias ALIAS] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
-cacert Import a CA's Trusted Certificate.
[-file FILE] [-storetype STORE_TYPE] [-keystore URL]
[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
Standard options:
-help print this help, then exit
-version print version number, then exit
-JOPTION pass argument to the Java runtime
Please report bugs at http://www.gnu.org/software/classpath/bugs.html
有什么问题,我该如何解决?我正在运行Linux Mint 17.2 Cinnamon。
答案 0 :(得分:3)
问题是有两个不同的工具,名称相同“keytool”。
一个附带你的linux发行版,当你在终端中编写“keytool”命令时默认使用它。当您运行man keytool
时,您可以看到说明:
NAME
gkeytool - Manage private keys and public certificate
但是出于您的目的,需要使用Java安装附带的keytool - 您必须找到Java目录,对我来说它位于/opt/java/jdk1.8.0_65/bin
。当你在这里时,只需运行相同的命令,但在命令开头使用./keytool
而不是keytool
,e。 G:
./keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v