Open ovk opened 3 years ago
Same problem here with importing p12 file generated with pkijs 3.0.15 to Windows 10 and Windows 11. Tested that no such problem when
is changed from 64 to 8 or 16 or 32.
OpenSSL 3.2+ changed salt from 8 to 16 bytes.
Please verify and consider reducing this salt length in pkijs from 64 to 32 or 16 bytes or making it configurable as proposed in this issue for Windows compatibility.
I've been trying to get PKCS12/PFX file generated by the
openSSLLikeInternal
function from thePKCS12SimpleExample
to work on Windows 10, and after some debugging it turned out that what was preventing it from working is the salt size.When OpenSSL generates similar file (also with AES) it always sets salt size to 8, while PKI.js has it hard-coded to 64. So suprisingly enough, after changing 64 to 8 in CryptoEngine:
https://github.com/PeculiarVentures/PKI.js/blob/275992a9abd3da14ce02194594d3d59042826be6/src/CryptoEngine.js#L1842
the resulting PKCS12 file suddenly works in Windows.
This is clearly not a bug in the PKI.js, but rather in Windows. However, it would be really helpful if PKI.js would allow to specify this salt size, to make it possible to generate PKCS12 files that work on Windows.
Linking #211 as it is tangentially related.