diff --git a/packages/node_modules/@node-red/nodes/core/network/05-tls.js b/packages/node_modules/@node-red/nodes/core/network/05-tls.js index 0c588fc66..3dd3ba8b5 100644 --- a/packages/node_modules/@node-red/nodes/core/network/05-tls.js +++ b/packages/node_modules/@node-red/nodes/core/network/05-tls.js @@ -31,7 +31,17 @@ module.exports = function(RED) { this.servername = (n.servername||"").trim(); this.alpnprotocol = (n.alpnprotocol||"").trim(); - if ((certPath && certPath.length > 0) || (keyPath && keyPath.length > 0) || (caPath && caPath.length > 0)) { + if (this.certType === "pfx" && p12Path && p12Path.length > 0) { + try { + this.pfx = fs.readFileSync(p12Path); + } + catch(err) { + this.valid = false; + this.error(err.toString()); + return; + } + } + else if ((certPath && certPath.length > 0) || (keyPath && keyPath.length > 0) || (caPath && caPath.length > 0)) { if ( (certPath && certPath.length > 0) !== (keyPath && keyPath.length > 0)) { this.valid = false; this.error(RED._("tls.error.missing-file")); @@ -55,16 +65,6 @@ module.exports = function(RED) { return; } } - else if (p12Path && p12Path.length > 0) { - try { - this.pfx = fs.readFileSync(p12Path); - } - catch(err) { - this.valid = false; - this.error(err.toString()); - return; - } - } else { if (this.credentials) { var certData = this.credentials.certdata || "";