什么是“配对”证书和密钥在密钥库中看起来像什么?
问题描述:
我有一个PKCS12文件,我已经导入密钥库CRT文件。但我不确定密钥库“知道”他们已配对。 (我只是假设它确实需要知道。)什么是“配对”证书和密钥在密钥库中看起来像什么?
密钥库-list:
Keystore type: BKS
Keystore provider: BC
Your keystore contains 2 entries
my_cert, , trustedCertEntry,
Certificate fingerprint (SHA1): ...
my_key, , PrivateKeyEntry,
Certificate fingerprint (SHA1): ...
UPDATE:只有现在我已经注意到他们在“证书指纹”相同的值。我想这就是诀窍......?
答
不,这不是诡计。 trustedCertEntry是多余的。 PrivateKeyEntry也总是包含证书(链)。
的PKCS#12文件显然不仅包含了密钥,但还证书(否则进口就失败了)。
可以与冗长开关“-v”查看证书的细节(尤其是与密钥对的条目相关联的证书链)。例如,这PrivateKeyEntry具有相关联的证书2:
keytool.exe -v -list -keystore ...
Alias name: cert
Creation date: Jan 24, 2016
Entry type: PrivateKeyEntry
Certificate chain length: 2
Certificate[1]:
Owner: CN=cert
Issuer: CN=root
Serial number: 5576e50e
Valid from: Tue Jun 09 15:07:33 CEST 2015 until: Thu Jun 09 15:07:33 CEST 2016
Certificate fingerprints:
...
Certificate[2]:
Owner: CN=root
Issuer: CN=root
Serial number: 5576e4f3
Valid from: Tue Jun 09 15:07:06 CEST 2015 until: Thu Jun 09 15:07:06 CEST 2016
Certificate fingerprints:
...