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:
parent
fbf2c7b570
commit
936f024e33
@ -31,7 +31,17 @@ module.exports = function(RED) {
|
|||||||
this.servername = (n.servername||"").trim();
|
this.servername = (n.servername||"").trim();
|
||||||
this.alpnprotocol = (n.alpnprotocol||"").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)) {
|
if ( (certPath && certPath.length > 0) !== (keyPath && keyPath.length > 0)) {
|
||||||
this.valid = false;
|
this.valid = false;
|
||||||
this.error(RED._("tls.error.missing-file"));
|
this.error(RED._("tls.error.missing-file"));
|
||||||
@ -55,16 +65,6 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (p12Path && p12Path.length > 0) {
|
|
||||||
try {
|
|
||||||
this.pfx = fs.readFileSync(p12Path);
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
this.valid = false;
|
|
||||||
this.error(err.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if (this.credentials) {
|
if (this.credentials) {
|
||||||
var certData = this.credentials.certdata || "";
|
var certData = this.credentials.certdata || "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user