从Java CA无法读取从Windows CA存储导出的证书

时间:2018-08-10 12:51:28

标签: java powershell certificate keytool pkcs#12

我正在使用与此处答案几乎相同的方法从Windows CA证书存储中导出证书: Get chain of certificates for a file with PowerShell?和此处Automate export x509 certificate w/chain from Server 2008 R2 to a p7b file WITHOUT external tools?,除非我从CA系统存储中获取。

这有效,并且openssl和certutil之类的东西可以读取我的证书。但是,我需要Java才能读取我的证书,并且Java 8 keystore类和keytool命令行工具(keytool -list -v -keystore v.p12 -storetype pkcs12 -storepass pass都说我的证书有0个条目,而openssl和certutil显示有条目。

我如何以Java可读格式导出证书,或者轻松地将其转换为Java可读格式,同时将其保存在pkcs12中?我实际上要导出的计算机没有openssl,因此请记住这一点。示例文件(密码为“ pass”)在此处:https://mega.nz/#!Cj5GGIBR!O5shbaPuHNKEJhRrivR0TY3hRd3ZRYQzvRQFJa_ri3s

1 个答案:

答案 0 :(得分:-1)

将PKCS12数据导入JKS密钥库:

keytool -importkeystore -srckeystore v.p12 -srcstoretype PKCS12 -destkeystore v.jks