获取SHA-1指纹的方法和获取指纹的方法一样吗?之前,我正在运行这个命令:

我不清楚我得到的结果是不是SHA-1指纹。有人能解释一下吗?


当前回答

我使用的是Ubuntu 12.0.4,我已经通过这种方式在命令提示符上获得了发布密钥存储的证书指纹 在生成keystore文件后,你可以使用这个密钥发布应用程序,如果你在你的应用程序中使用谷歌映射,这样可以在发布后在应用程序中正确显示映射,我在下面的命令提示符中得到了结果

administrator@user:~$ keytool -list -v -keystore /home/administrator/mykeystore/mykeystore.jks -alias myprojectalias Enter keystore password: ****** Alias name: myprojectalias Creation date: 22 Apr, 2014 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=xyz, OU= xyz, O= xyz, L= xyz, ST= xyz, C=91 Issuer: CN= xyz, OU= xyz, O= xyz, L= xyz, ST= xyz, C=91 Serial number: 7c4rwrfdff Valid from: Fri Apr 22 11:59:55 IST 2014 until: Tue Apr 14 11:59:55 IST 2039 Certificate fingerprints: MD5: 95:A2:4B:3A:0D:40:23:FF:F1:F3:45:26:F5:1C:CE:86 SHA1: DF:95:Y6:7B:D7:0C:CD:25:04:11:54:FA:40:A7:1F:C5:44:94:AB:90 SHA276: 00:7E:B6:EC:55:2D:C6:C9:43:EE:8A:42:BB:5E:14:BB:33:FD:A4:A8:B8:5C:2A:DE:65:5C:A3:FE:C0:14:A8:02 Signature algorithm name: SHA276withRSA Version: 2 Extensions: ObjectId: 2.6.28.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: 1E A1 57 F2 81 AR 57 D6 AC 54 65 89 E0 77 65 D9 ..W...Q..Tb..W6. 0010: 3B 38 9C E1

在Windows平台上,我们可以使用下面的方法获取调试模式的密钥库

C:\Program Files\Java\jdk1.8.0_102\bin>keytool -l .android\debug.keystore -alias androiddebugkey -s id Alias name: androiddebugkey Creation date: Oct 21, 2016 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: Fri Oct 21 00:50:00 IST 2016 until: S Certificate fingerprints: MD5: 86:E3:2E:D7:0E:22:D6:23:2E:D8:E7:E SHA1: B4:6F:BE:13:AA:FF:E5:AB:58:20:A9:B SHA256: 15:88:E2:1E:42:6F:61:72:02:44:68 56:49:4C:32:D6:17:34:A6:7B:A5:A6 Signature algorithm name: SHA1withRSA

其他回答

如果你使用React Native,调试。Keystore在android/app中,但可能不在~/.android中。

设置调试。Keystore路径如下:

keytool -list -v -keystore {PROJECT_ROOT}/android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android

控制台将打印如下内容:

Alias name: androiddebugkey
Creation date: Jan 1, 2014
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, OU=Android, O=Unknown, L=Unknown, ST=Unknown, C=US
Issuer: CN=Android Debug, OU=Android, O=Unknown, L=Unknown, ST=Unknown, C=US
Serial number: 2==Serial Number==2
Valid from: Wed Jan 01 06:35:04 CST 2014 until: Wed May 01 06:35:04 CST 2052
Certificate fingerprints:
     SHA1: 5E:=========== SHA1 SIGNING KEY ===========:25
     SHA256: FA:============ SHA 256 ===================9C
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

你可以通过去Window>Preference>Android>Build in Eclipse获取任何工作区的MD5和SHA1指纹。

如果您正在使用eclipse,请转到: 窗口- >首选项- > Android - >构建 你会在那里找到你要找的东西。

除了Lokesh Tiwar的回答

对于发布版本,在gradle中添加以下内容:

android {

defaultConfig{
//Goes here
}

    signingConfigs {
        release {
            storeFile file("PATH TO THE KEY_STORE FILE")
            storePassword "PASSWORD"
            keyAlias "ALIAS_NAME"
            keyPassword "KEY_PASSWORD"
        }
    }
buildTypes {
        release {
            zipAlignEnabled true
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

现在运行Lokesh's Answer中的signingReport将显示发布版本的SHA 1和MD5密钥。

//获取SHA1的最简单方法

//添加以下命令到您的终端并按enter

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android