Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying salt size for better compatibility with Windows #300

Open
ovk opened this issue Dec 15, 2020 · 1 comment
Open

Allow specifying salt size for better compatibility with Windows #300

ovk opened this issue Dec 15, 2020 · 1 comment
Assignees

Comments

@ovk
Copy link

ovk commented Dec 15, 2020

I've been trying to get PKCS12/PFX file generated by the openSSLLikeInternal function from the PKCS12SimpleExample 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:

const saltBuffer = new ArrayBuffer(64);

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.

@pboguslawski
Copy link

pboguslawski commented Feb 9, 2024

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

const saltBuffer = new ArrayBuffer(64);

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.

pboguslawski added a commit to ibpl/web-certificate-tool that referenced this issue Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants