密钥库文件中没有名称别名(P12)

时间:2016-01-15 00:49:11

标签: certificate ssl-certificate keystore pkcs#12 truststore

收到密钥库文件fac_sign.p12以获取具有密钥库密码的生产访问权限,但是当我查看证书的详细信息时,没有别名来获取证书。下面是运行命令

时的结果(仅复制顶行)
keytool -list -v -keystore usr/local/HIService/Keys/fac_sign.p12
-storetype PKCS12

Keystore type: PKCS12
Keystore provider: SunJSSE
Your keystore contains 1 entry
Alias name:
Creation date: Jan 15, 2016
Entry type: PrivateKeyEntry
Certificate chain length: 3
Certificate[1]:
Owner: CN=Specialist :7786786786, OU=Specialist, O=Specialist, L=MT HELEN, ST=VIC, C=AU
Issuer: CN=Medicare Australia Organisation Certification Authority, OU=Medicare Australia, O=GOV, C=AU
Serial number: 4abcd
Valid from: Wed Feb 19 12:40:07 EST 2014 until: Tue Feb 19 12:39:59 EST 2019
Certificate fingerprints:
MD5:  4C:B2:A4:6C:5D:B7:71:7A:35:4A:39:33:D7:87:64:93
SHA1: C7:46:01:A3:B9:A6:E4:D3:7E:5D:98:9D:D3:22:B9:7A:B6:D1:79:66

在java代码中,下面的代码行返回NULL,因为keystoreAlias =“”

(KeyStore.PrivateKeyEntry) keystore.getEntry(keystoreAlias,new KeyStore.PasswordProtection(keystorePassword.toCharArray()));

请建议。

2 个答案:

答案 0 :(得分:0)

使用“keystore explorer”(http://keystore-explorer.org/downloads.html)打开,更改别名字段并保存。

答案 1 :(得分:0)

我遇到了同样的问题,因为OpenJDK 8/9有一个错误,该错误阻止加载带有空别名的密钥。但是使用keytool更改别名很容易。

keytool -changealias -alias "" -destalias "new-alias" -keystore ./keystore.p12