From f79a31ff3c407f71deea7f1008a37f8b03c90808 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 16 Jul 2014 18:12:53 -0700 Subject: [PATCH] paypro: get single DER certs working. --- lib/PayPro.js | 6 +++--- lib/browser/PayPro.js | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/PayPro.js b/lib/PayPro.js index d35bbbe..6d64bb8 100644 --- a/lib/PayPro.js +++ b/lib/PayPro.js @@ -254,10 +254,10 @@ PayPro.prototype.verify = function() { var der = pki_data.toString('hex'); var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(der, 'CERTIFICATE'); - var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY') - // var pub = KJUR.X509.getPublicKeyFromCertPEM(pem); + // var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY') - return verifier.verify(pub, sig); + // return verifier.verify(pub, sig); + return verifier.verify(pem, sig); } else if (pki_type === 'none') { return true; } diff --git a/lib/browser/PayPro.js b/lib/browser/PayPro.js index 0fa4508..6cfcefd 100644 --- a/lib/browser/PayPro.js +++ b/lib/browser/PayPro.js @@ -35,8 +35,7 @@ PayPro.sign = function(key) { var der = pki_data.toString('hex'); var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(der, 'CERTIFICATE'); - var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY') - // var pub = KJUR.X509.getPublicKeyFromCertPEM(pem); + // var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY') var jsrsaSig = new KJUR.crypto.Signature({ alg: type + 'withRSA', @@ -83,8 +82,7 @@ PayPro.verify = function() { var der = pki_data.toString('hex'); var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(der, 'CERTIFICATE'); - var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY') - // var pub = KJUR.X509.getPublicKeyFromCertPEM(pem); + // var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY') jsrsaSig.initVerifyByCertificatePEM(pem);