I'm trying to sign data with a soft certificate stored on a PC. I'm completely new to using MsCAPI. My code below just always gives the "Uninitialized keystore" exception. How do I initialize it? I tried setting the KeyStore as null before assigning it the instance, but this didn't work either. Any ideas?
try {
KeyStore store = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
Vector certificateVector = new java.util.Vector();
for (java.util.Enumeration e = store.aliases(); e.hasMoreElements();) {
String alias = (String) e.nextElement();
X509Certificate cert = (X509Certificate) store.getCertificate(alias);
if (!store.isKeyEntry(alias)) {
continue;
}
}
} catch (KeyStoreException ex) {
Logger.getLogger(testarea.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchProviderException ex) {
Logger.getLogger(testarea.class.getName()).log(Level.SEVERE, null, ex);
}
I will gladly provide more details for those who want them, I'm just not sure what to include in this post.
Cheers
Ed