8

I want to leverage the Windows Certificate Store in my Java application. I am able to load a keystore from Windows-MY that has all the aliases/certs I need, but when loading it I am faced with a dialog box asking to "Please insert a smart card". If I click cancel on this a few times, they keystore still loads with the right content.

Is there a way to suppress this dialog box? Also is there a way to use the Windows certificate selection box from Java? The only answer I have seen on the net is this: https://social.msdn.microsoft.com/Forums/en-US/52dca221-1e05-44c1-8c45-9e0d4a807853/java-keystoreload-for-windowsmy-pops-up-insert-smart-card-window?forum=windowssecurity, but I don't want to have to remove anything because I don't expect the users to do that.

Here is how I am loading the keystore:

KeyStore ks = KeyStore.getInstance("Windows-MY");
ks.load(null, null);
Seephor
  • 1,692
  • 3
  • 28
  • 50

1 Answers1

1

I never tried to load the certificase through the keystore, but supplied them by means of System properties.

System.setProperty("javax.net.ssl.keyStoreType", "Windows-MY");
System.setProperty("javax.net.ssl.keyStore", "NONE");
System.setProperty("javax.net.ssl.trustStoreType", "Windows-ROOT");
System.setProperty("javax.net.ssl.trustStore", "NONE");

See also java SSL and cert keystore and How to use the Windows Keystore (MCS) with JDBC?

Community
  • 1
  • 1
hotzst
  • 7,238
  • 9
  • 41
  • 64
  • I can't go through the system properties route because they are already set. The application connects to a server already and has these properties set, but I need the user to be able to select certs from the MS Cert Store so I can wrap them in an SSL context for HTTP services. – Seephor Oct 27 '15 at 17:19