I'm following https://github.com/digitalbazaar/forge#pkcs12 these steps to convert pem cert to p12. And I want .p12 certificate in binary format , don't want to encode it further using base64 as mentioned in above link. If I skip the last step
var p12b64 = forge.util.encode64(p12Der);
then from the output file (which contents the Bytes i.e. p12Der ) I'm not able to extract certificate and keys using openSSL. Steps followed to extract certificates:
openssl pkcs12 -in enc.p12 -out cert.crt -nokeys -clcerts
Which throws following error
4145202984:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:157:
How can I generate p12 file in binary format using https://github.com/digitalbazaar/forge#pkcs12 these steps without encoding it(i.e. by skipping the last step to create p12b64)?
Plus, how can I download this file using plain JS (without node)?