title: Forge Errors with reading p12 and pfx files
body: <p>I am having the following errors when trying read/decode p12 and pfx files: </p>
  
  <pre><code>Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX
  
  Too few bytes to read ASN.1 value.
  </code></pre>
  
  <p>I am trying to read the file in Javascript with the following: </p>
  
  <pre><code>&lt;input id="cert-file" type="file" name="cert" /&gt;&lt;output id="p12cert"&gt;&lt;/output&gt;
  </code></pre>
  
  <p>Using JQuery, I attach a "on change" event handler, to check the selected file. </p>
  
  <pre><code>$j("#cert-file").change(handleFileSelect);
  
  function handleFileSelect(evt) {
      var files = evt.target.files; // FileList object
      getFile(files[0]);    
  }
  </code></pre>
  
  <p>Then I try to read the file and decode it using forge. </p>
  
  <pre><code>function getFile(p12cert)
  {
      var reader = new FileReader();
  
      var password = 'password';
  
      reader.onload = (function (theFile) {
          return function(eve) {
  
              var p12Der = forge.util.decode64(eve.target.result);
  
              // get p12 as ASN.1 object
              // Not working for one of my p12 files
              var p12Asn1 = forge.asn1.fromDer(p12Der);
  
              // decrypt p12 using the password 'password'
              // TODO: Not working for some reason for p12 and pfx file
              var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, password);
          };
      })(p12cert);
  
  reader.readAsText(p12cert);
  </code></pre>
  
  <p>}</p>
  
  <p>I'm not sure if I'm just reading the file in wrong. I was going off of the FileReader examples from <a href="http://www.html5rocks.com/en/tutorials/file/dndfiles/">here</a>. Am I doing something wrong or could something possibly be wrong with my certs? </p>