fix: remove password parameter from pemToPfx function and update PFX creation logic

This commit is contained in:
2026-05-22 14:34:29 +02:00
parent e484b465e8
commit 17fecaca22
+2 -2
View File
@@ -6,7 +6,7 @@ export interface PemBundle {
chainPem: string;
}
export function pemToPfx(privateKeyPem: string, certPem: string, chainPem: string, password = ''): Buffer {
export function pemToPfx(privateKeyPem: string, certPem: string, chainPem: string): Buffer {
const key = forge.pki.privateKeyFromPem(privateKeyPem);
const cert = forge.pki.certificateFromPem(certPem);
const chain = chainPem
@@ -14,7 +14,7 @@ export function pemToPfx(privateKeyPem: string, certPem: string, chainPem: strin
.filter(Boolean)
.map(p => forge.pki.certificateFromPem(p));
const p12 = forge.pkcs12.toPkcs12Asn1(key, [cert, ...chain], password, { algorithm: '3des' });
const p12 = forge.pkcs12.toPkcs12Asn1(key, [cert, ...chain], null);
const der = forge.asn1.toDer(p12).getBytes();
return Buffer.from(der, 'binary');
}