title: how to load private key in windows store using Java KeyStore
body: <p>I am working on this Java project, where i need to load a private key from Windows KeyStore using the provider SunMSCAPI, but i don't supply any password at all, i don't know if i need to do so.
  this is sample test case of what i'm doing:</p>
  
  <pre><code>public static void main(String[] args) throws Throwable {
      Provider provider = Security.getProvider("SunMSCAPI");
      KeyStore wins=KeyStore.getInstance("Windows-MY", provider);
      wins.load(null, null);
      Enumeration&lt;String&gt; aliases = wins.aliases();
      while (aliases.hasMoreElements()) {
          String alias = (String) aliases.nextElement();
          System.out.println(alias);
          Certificate[] chain = wins.getCertificateChain(alias);
          X509Certificate[] x509 = CERManager.toX509(chain);
          for (int i = 0; i &lt; x509.length; i++) {
              System.out.println(x509[i].getSubjectX500Principal());
          }
          Key key = wins.getKey(alias, "1234".toCharArray());
          System.out.println(key);
  
      }
  
  }
  </code></pre>
  
  <p>when i run this i get some certificate that i imported previously from a pfx file using Adobe Reader, but i can't get the private key corresponding to that certificate, instead, i just get null.</p>
  
  <p>any help around this issue? thanks in advance</p>