title: TypeError: Cannot read property 'tagClass' of undefined in Node js
body: <pre><code>var forge = require('node-forge');
  //some code here
  
  var keyFile = fs.readFileSync('./test.p12', 'binary');
  var p12Asn1 = forge.asn1.fromDer(keyFile);
  var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1,false, employeeID);
  var bags = p12.getBags({bagType: forge.pki.oids.certBag});
  var cert = bags[forge.pki.oids.certBag][0];
  var msg = {
  type: 'CERTIFICATE',
  body: forge.asn1.toDer(asn1.cert).getBytes()
  };
  var pem = forge.pem.encode(msg);
  </code></pre>
  
  <p>I am trying to read certificate,RSA private key and publick key from p12 file. This is the code i have written in Node js, but getting TypeError.</p>