From 6eab17546770e54d666ca78a96e64634b7326e8e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 22 Aug 2014 13:21:21 -0700 Subject: [PATCH] Revert "paypro: attempted debugging with KJUR." This reverts commit 5788fdbb52a42e8e4a1841f5d67af9afef5e3082. --- lib/PayPro.js | 54 +-------------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/lib/PayPro.js b/lib/PayPro.js index 7dac0b5..2588e6d 100644 --- a/lib/PayPro.js +++ b/lib/PayPro.js @@ -93,65 +93,13 @@ PayPro.prototype.x509Verify = function() { var data = new Buffer(nder, 'hex'); var nc = rfc3280.Certificate.decode(data, 'der'); var npubKey = nc.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey.data; - npubKey = npubKey.toString('hex'); - //npubKey = self._DERtoPEM(npubKey, 'RSA PUBLIC KEY'); + npubKey = self._DERtoPEM(npubKey, 'RSA PUBLIC KEY'); // Get signature from current certificate: var data = new Buffer(der, 'hex'); var c = rfc3280.Certificate.decode(data, 'der'); var sig = c.signature.data; - - var jsrsaSig = new KJUR.crypto.Signature({ - alg: type + 'withRSA', - prov: 'cryptojs/jsrsa' - }); - //var key = new KJUR.RSAKey(); - //key.readPublicKeyFromPEMString(npubKey); - //jsrsaSig.initVerifyByPublicKey(_npubKey.toString('hex')); - // http://kjur.github.io/jsrsasign/api/symbols/KJUR.crypto.Signature.html - // http://kjur.github.io/jsrsasign/api/symbols/RSAKey.html - - // KEYUTIL: - // getKeyFromPublicPKCS8Hex - // getKeyFromPublicPKCS8PEM - // getKeyFromCSRPEM - // getKeyFromCSRHex - // getKey - // getHexFromPEM(sPEM, sHead) - // getKeyFromEncryptedPKCS8PEM(pkcs8PEM, passcode) - // getKeyFromPublicPKCS8Hex(pkcsPub8Hex) - // getKeyFromPublicPKCS8PEM(pkcsPub8PEM) - // getPEM(keyObjOrHex, formatType, passwd, encAlg) - // getRSAKeyFromPublicPKCS8PEM(pkcs8PubPEM) - // getKeyFromPublicPKCS8Hex(pkcsPub8Hex) - - // http://kjur.github.io/jsrsasign/api/symbols/KEYUTIL - // var key = KJUR.KEYUTIL.getRSAKeyFromPublicPKCS8PEM(npubKey); - // var key = KJUR.KEYUTIL.getHexFromPEM(npubKey, 'RSA PUBLIC KEY'); - // var key = KJUR.KEYUTIL.getKeyFromPublicPKCS8PEM(npubKey); - // var key = KJUR.KEYUTIL.getKey(npubKey, null, 'der'); - // var key = KJUR.KEYUTIL.getKeyFromCSRHex(npubKey); - // var key = KJUR.KEYUTIL.getKeyFromPublicPKCS8Hex(npubKey); - // var key = KJUR.KEYUTIL.getRSAKeyFromPlainPKCS8Hex(npubKey); - // var key = KJUR.KEYUTIL.getRSAKeyFromPublicPKCS8Hex(npubKey); - // var key = KJUR.KEYUTIL.parsePublicPKCS8Hex(npubKey); - - // var key = KJUR.KEYUTIL.parsePublicRawRSAKeyHex(npubKey); - // key = KJUR.KEYUTIL.getKey(key); - - jsrsaSig.initVerifyByPublicKey(key); - - // Create a To-Be-Signed Certificate to verify using asn1.js: - // Fails at Issuer: - var tbs = rfc3280.TBSCertificate.encode(c.tbsCertificate, 'der'); - jsrsaSig.updateHex(tbs.toString('hex')); - - return jsrsaSig.verify(sig); - - - - var verifier = crypto.createVerify('RSA-' + type); // Create a To-Be-Signed Certificate to verify using asn1.js: