From 4e325c3fa93becc4f8473578b89ae29b7bef108e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 22 Aug 2014 09:05:05 -0700 Subject: [PATCH] paypro: fix root cert check. --- lib/PayPro.js | 3 +++ lib/browser/PayPro.js | 3 +++ 2 files changed, 6 insertions(+) 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; }