paypro: rename type to sigHashAlg.
This commit is contained in:
parent
a50b9ed3a3
commit
b53e285a7c
|
@ -135,7 +135,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 = PayPro.DERtoPEM(der, 'CERTIFICATE');
|
||||
|
@ -189,7 +192,7 @@ PayPro.verifyCertChain = function(chain, type) {
|
|||
// from the DER Certificate:
|
||||
var tbs = PayPro.getTBSCertificate(data);
|
||||
|
||||
var verifier = crypto.createVerify(type ? 'RSA-' + type : 'RSA');
|
||||
var verifier = crypto.createVerify('RSA-' + sigHashAlg);
|
||||
verifier.update(tbs);
|
||||
var sigVerified = verifier.verify(npubKey, sig);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue