digitalbazaar / forge

A native implementation of TLS in Javascript and tools to write crypto-based and network-heavy webapps
https://digitalbazaar.com/
Other
5.01k stars 767 forks source link

Support different MAC Algorithms to generate PKCS12 wrapper #1061

Open leninmehedy opened 6 months ago

leninmehedy commented 6 months ago

Background

Currently openssl or keytool uses SHA256 to generate MAC data for pkcs12. However, node-forge uses SHA1 as here

openssl also allows specifying the macAlgorithm using parameter below:

-macalg val Digest algorithm to use in MAC (default SHA256)

node-forge currently allows reading pkcs12 files generated by other tool and supports detecting the MAC algorithm used as you can find here

Proposal

We should allow passing a new option called options.macAlgorithm for function p12.toPkcs12Asn1.

Here:

leninmehedy commented 6 months ago

I have a fix made locally and will make a PR for your consideration and review.