diff --git a/lib/PayPro.js b/lib/PayPro.js index fbcf291..2588e6d 100644 --- a/lib/PayPro.js +++ b/lib/PayPro.js @@ -80,6 +80,9 @@ PayPro.prototype.x509Verify = function() { var ncert = chain[i + 1]; // The root cert, check if it's trusted: if (!ncert || name) { + if (!ncert && !name) { + return false; + } chain.length = 0; return true; } diff --git a/lib/browser/PayPro.js b/lib/browser/PayPro.js index fe5d565..fc4af87 100644 --- a/lib/browser/PayPro.js +++ b/lib/browser/PayPro.js @@ -90,6 +90,9 @@ PayPro.prototype.x509Verify = function(key) { var ncert = chain[i + 1]; // The root cert, check if it's trusted: if (!ncert || name) { + if (!ncert && !name) { + return false; + } chain.length = 0; return true; }