如何列出存储在与密钥工具一个PKCS12密钥库中的证书?(How to list the certi

2019-08-07 03:42发布

我想列出存储在PKCS12密钥库证书。

密钥库具有扩展名.pfx

Answer 1:

如果密钥库是PKCS12类型( .pfx ),你必须与指定它-storetype PKCS12 (增加了可读性换行):

keytool -list -v -keystore <path to keystore.pfx> 
    -storepass <password> 
    -storetype PKCS12


Answer 2:

您还可以使用openssl来完成同样的事情:

$ openssl pkcs12 -nokeys -info \
    -in </path/to/file.pfx> \
    -passin pass:<pfx's password>

MAC Iteration 2048
MAC verified OK
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Certificate bag
Bag Attributes
    localKeyID: XX XX XX XX XX XX XX XX XX XX XX XX XX 48 54 A0 47 88 1D 90
    friendlyName: jedis-server
subject=/C=US/ST=NC/L=Raleigh/O=XXX Security/OU=XXX/CN=something1
issuer=/C=US/ST=NC/L=Raleigh/O=XXX Security/OU=XXXX/CN=something1
-----BEGIN CERTIFICATE-----
...
...
...
-----END CERTIFICATE-----
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048


文章来源: How to list the certificates stored in a PKCS12 keystore with keytool?