title: How to load a certificate from "Credential storage"?
body: <p>My network code is written in NDK (cURL + OpenSSL) and I'd like to use a certificate from Android's credential storage as a client certificate for a SSL connection. Moreover, I'd like to offer a list of available certificates to the user, so he can choose the certificate for the connection. Unfortunately, I cannot obtain a certificate from the key storage.</p>
  
  <p>I installed a client certificate to "Credential storage" (Settings -> Secutrity -> ...) on my Android device (5.0.2), but I'm not able to access it from Java. I tried to call following code, but the key storage is empy, athough the certificate is installed in the Credential storage:</p>
  
  <pre><code>//KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
  KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
  ks.load(null);
  
  Enumeration&lt;String&gt; aliases = ks.aliases();
  while(aliases.hasMoreElements()) {
      String alias = (String)aliases.nextElement();
      Log.i("app", "alias name: " + alias);
      Certificate certificate = ks.getCertificate(alias);
      Log.i("app", certificate.toString());
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>