Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MsCAPI "Uninitialized keystore"

843811May 2 2008 — edited May 2 2008
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 30 2008
Added on May 2 2008
1 comment
506 views