title: toDerInputStream rejects tag type 0 - Cannot read key from keystore
body: <p>In my Android app, I have a keystore file named <code>keystore.p12</code>, which is located in <code>/data/data/com.company.myapp/files</code>. I pulled this particular file and now I want to retrieve the key stored inside it.</p>
  
  <p>I tried it with the keytool like this:</p>
  
  <pre><code>&gt;keytool.exe -list -keystore C:\Users\user\Desktop\keystore.p12 -storepass letmein -storetype PKCS12 -v
  </code></pre>
  
  <p>Unfortunately, I get the following error:</p>
  
  <pre><code>keytool error: java.io.IOException: toDerInputStream rejects tag type 0
  java.io.IOException: toDerInputStream rejects tag type 0
          at sun.security.util.DerValue.toDerInputStream(DerValue.java:874)
          at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1915)
          at java.security.KeyStore.load(KeyStore.java:1445)
          at sun.security.tools.keytool.Main.doCommands(Main.java:795)
          at sun.security.tools.keytool.Main.run(Main.java:343)
          at sun.security.tools.keytool.Main.main(Main.java:336)
  </code></pre>
  
  <p>I tried the same thing with Java, but I experience the same exception:</p>
  
  <pre><code>public static void main(String[] args) {
          try {
              FileInputStream is = new FileInputStream("C:\\Users\\user\\Desktop\\keystore.p12");
              KeyStore keystore = KeyStore.getInstance("pkcs12");
              keystore.load(is, "letmein".toCharArray());
              is.close();
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Any idea how I can solve this issue?</p>