Export certificate in Windows store to p12 file using Java

I will need to export the certificate in the Windows store to a p12 file. Similar to what you can do in Firefox / IE, but in JAVA. The only way I can do this at this time is to do C # with double Cpp wrappers or MCPP wrappers using JNI, which is not very useful. I tried using SUNMSCAPI but I couldn’t .. Any inputs appreciated .. Thanks ..

If the above is certainly not possible, can you create a keystore with these certificates?

+7
source share
1 answer

You can use the standard Java keystore API, Bouncy Castle . You can download the Windows-MY keystore, which contains all the certificates stored in the Windows keystore.

 KeyStore.getInstance("Windows-MY"); 

The Windows Key Store reference provides a method for extracting certificates using the KeyStore.getCertificate(String alias) method.

After receiving the certificate, export it to the PKCS12 file.

+4
source

All Articles