简体   繁体   English

使用Java将Windows存储中的证书导出到p12文件

[英]Export certificate in windows store to a p12 file using Java

I will need to export a certificate in windows store to a p12 file. 我需要将Windows应用商店中的证书导出到p12文件。 Similar to what you can do from firefox/IE browser but in JAVA. 类似于你可以从firefox / IE浏览器,但在JAVA。 The only way I am able to do it currently is doing a C# with double Cpp wrappers or MCPP with wrapper using JNI which is not really useful. 我目前能够做到的唯一方法是使用双Cpp包装器进行C#或使用JNI进行包装的MCPP实际上并不实用。 I have tried using SUNMSCAPI but I was not able to.. Any inputs appreciated.. Thank you.. 我尝试过使用SUNMSCAPI,但我无法...任何输入赞赏..谢谢..

If the above is certainly not possible, can a keystore be created with these certs? 如果以上肯定不可能,可以使用这些证书创建密钥库吗?

You can use the Java standard keystore API, with Bouncy Castle . 您可以使用带有Bouncy Castle的Java标准密钥库API。 You can load the keystore called Windows-MY , that contains all the certificates stored in the Windows keystore. 您可以加载名为Windows-MY的密钥库,其中包含存储在Windows密钥库中的所有证书。

KeyStore.getInstance("Windows-MY");

The reference to the Windows keystore provides method to extract certificates, via the KeyStore.getCertificate(String alias) method . 对Windows密钥库的引用提供了通过KeyStore.getCertificate(String alias)方法提取证书的方法

Once you retrieved the certificate, export it to a PKCS12 file. 检索证书后,将其导出到PKCS12文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM