fix: remove password parameter from pemToPfx function and update PFX creation logic
This commit is contained in:
+2
-2
@@ -6,7 +6,7 @@ export interface PemBundle {
|
|||||||
chainPem: string;
|
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 key = forge.pki.privateKeyFromPem(privateKeyPem);
|
||||||
const cert = forge.pki.certificateFromPem(certPem);
|
const cert = forge.pki.certificateFromPem(certPem);
|
||||||
const chain = chainPem
|
const chain = chainPem
|
||||||
@@ -14,7 +14,7 @@ export function pemToPfx(privateKeyPem: string, certPem: string, chainPem: strin
|
|||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map(p => forge.pki.certificateFromPem(p));
|
.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();
|
const der = forge.asn1.toDer(p12).getBytes();
|
||||||
return Buffer.from(der, 'binary');
|
return Buffer.from(der, 'binary');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user