title: Import .p12-file into AndroidKeyStore
body: <p>The user has saved a .p12-file (e.g. his S/MIME certificate) on SD-Card. I want to load this certificate (or the extracted private and public key) into the AndroidKeyStore. </p>
  
  <pre><code>File file = new File(pathToP12File);
  Certificate c = null; // TODO: convert file into something I can load into the keystore
  
  KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
  ks.load(null);
  ks.setCertificateEntry("myCertAlias", c);
  </code></pre>
  
  <p>What's the best way to convert the file into something which can be set as a certificate entry in the keystore?</p>