我可以使用openssl提取基于友好名称的密钥吗?



我的密钥库包含2个密钥,我想运行2个命令,它们将基于别名/friendlyName输出每个密钥。此时,下面的命令将两个密钥输出到TESTKEY.key文件。我已经阅读了openssl文档,并尝试使用-name参数,后面跟着每个各自的友好名称,但它仍然输出两个密钥到一个文件。winpty用于gitbash

winpty openssl pkcs12 -in KEYSTORE_NAME.p12 -out TESTKEY.key -nodes -nocerts

尝试-name,但产生相同的输出:

winpty openssl pkcs12 -in KEYSTORE_NAME.p12 -name friendly_name_one -out KEY_ONE.key -nodes -nocerts

我无法用openssl解决这个问题,但是Javakeytool在这方面似乎更强大。下面的命令导出私钥和相应的证书。你可以随意设置(keytool -importkeystore --help)

keytool -importkeystore -srckeystore /path/to/cert/combined.p12 -srcalias http_ca -destkeystore /path/to/cert/single.p12

使用以下命令之一获取srcalias:

keytool -list -keystore /path/to/cert/combined.p12

openssl pkcs12 -in /path/to/cert/combined.p12 -info -nodes

相关内容

最新更新