|
|
@ -149,7 +149,10 @@ PayPro.prototype.x509Verify = function(returnTrust) { |
|
|
|
return verified && chainVerified; |
|
|
|
}; |
|
|
|
|
|
|
|
PayPro.verifyCertChain = function(chain, type) { |
|
|
|
PayPro.verifyCertChain = function(chain, sigHashAlg) { |
|
|
|
if (sigHashAlg === 'none') { |
|
|
|
return true; |
|
|
|
} |
|
|
|
return chain.every(function(cert, i) { |
|
|
|
var der = cert.toString('hex'); |
|
|
|
// var pem = self._DERtoPEM(der, 'CERTIFICATE');
|
|
|
@ -180,9 +183,9 @@ PayPro.verifyCertChain = function(chain, type) { |
|
|
|
//
|
|
|
|
// Get Public Key from next certificate (via KJUR because it's a mess):
|
|
|
|
//
|
|
|
|
if (type !== 'none') { |
|
|
|
if (sigHashAlg !== 'none') { |
|
|
|
var js = new KJUR.crypto.Signature({ |
|
|
|
alg: type + 'withRSA', |
|
|
|
alg: sigHashAlg + 'withRSA', |
|
|
|
prov: 'cryptojs/jsrsa' |
|
|
|
}); |
|
|
|
js.initVerifyByCertificatePEM(npem); |
|
|
@ -212,9 +215,9 @@ PayPro.verifyCertChain = function(chain, type) { |
|
|
|
// Verify current Certificate signature
|
|
|
|
//
|
|
|
|
|
|
|
|
if (type !== 'none') { |
|
|
|
if (sigHashAlg !== 'none') { |
|
|
|
var jsrsaSig = new KJUR.crypto.Signature({ |
|
|
|
alg: type + 'withRSA', |
|
|
|
alg: sigHashAlg + 'withRSA', |
|
|
|
prov: 'cryptojs/jsrsa' |
|
|
|
}); |
|
|
|
jsrsaSig.initVerifyByPublicKey(npubKey); |
|
|
|