p12 file from where I want to extract public and private keys and the x509 certificate with pki.js But my .p12 file has a password how can I decode it. For example:
const asn1js = require("asn1js");
const pkijs = require("pkijs");
const Certificate = pkijs.Certificate;
let path = __dirname + "/file.p12";
let file = fs.readFileSync(path);
const asn1 = asn1js.fromBER(file);
//What do I do with the password for the .p12 file?
const certificate = new Certificate({ schema: asn1.result });
There is an example of doing this in the PKIjs repository; https://github.com/PeculiarVentures/PKI.js/tree/master/examples/NodePKCS12Example