mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	reverse test logic of existence of pfx
This commit is contained in:
		| @@ -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 || ""; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user