From 538c6c32de0cf359a604c4a403a3476cfc82301a Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 16 Jul 2014 14:57:21 -0700 Subject: [PATCH] paypro: figure out clientside jsrasign more. --- lib/browser/PayPro.js | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/lib/browser/PayPro.js b/lib/browser/PayPro.js index b00f463b8..ad642bf0f 100644 --- a/lib/browser/PayPro.js +++ b/lib/browser/PayPro.js @@ -3,31 +3,11 @@ var Key = require('./Key'); var x509 = require('./x509'); var RSAKey = x509.RSAKey; +var KeyUtil = x509.KEYUTIL; +var Signature = x509.crypto.Signature; var assert = require('assert'); var PayPro = require('../PayPro'); -/* -rsasign-1.2.js:RSAKey.prototype.verifyPSS = _rsasign_verifyStringPSS; -rsasign-1.2.js:RSAKey.prototype.signWithMessageHash = _rsasign_signWithMessageHash; -rsasign-1.2.js:RSAKey.prototype.signString = _rsasign_signString; -rsasign-1.2.js:RSAKey.prototype.signStringWithSHA1 = _rsasign_signStringWithSHA1; -rsasign-1.2.js:RSAKey.prototype.signStringWithSHA256 = _rsasign_signStringWithSHA256; -rsasign-1.2.js:RSAKey.prototype.sign = _rsasign_signString; -rsasign-1.2.js:RSAKey.prototype.signWithSHA1 = _rsasign_signStringWithSHA1; -rsasign-1.2.js:RSAKey.prototype.signWithSHA256 = _rsasign_signStringWithSHA256; -rsasign-1.2.js:RSAKey.prototype.signWithMessageHashPSS = _rsasign_signWithMessageHashPSS; -rsasign-1.2.js:RSAKey.prototype.signStringPSS = _rsasign_signStringPSS; -rsasign-1.2.js:RSAKey.prototype.signPSS = _rsasign_signStringPSS; -rsasign-1.2.js:RSAKey.prototype.verifyWithMessageHash = _rsasign_verifyWithMessageHash; -rsasign-1.2.js:RSAKey.prototype.verifyString = _rsasign_verifyString; -rsasign-1.2.js:RSAKey.prototype.verifyHexSignatureForMessage = _rsasign_verifyHexSignatureForMessage; -rsasign-1.2.js:RSAKey.prototype.verify = _rsasign_verifyString; -rsasign-1.2.js:RSAKey.prototype.verifyHexSignatureForByteArrayMessage = _rsasign_verifyHexSignatureForMessage; -rsasign-1.2.js:RSAKey.prototype.verifyWithMessageHashPSS = _rsasign_verifyWithMessageHashPSS; -rsasign-1.2.js:RSAKey.prototype.verifyStringPSS = _rsasign_verifyStringPSS; -rsasign-1.2.js:RSAKey.prototype.verifyPSS = _rsasign_verifyStringPSS; -*/ - PayPro.sign = function(key) { if (this.messageType !== 'PaymentRequest') throw new Error('Signing can only be performed on a PaymentRequest'); @@ -43,10 +23,10 @@ PayPro.sign = function(key) { var pki_data = this.get('pki_data'); // contains one or more x509 certs var type = pki_type.split('+').toUpperCase(); var buf = this.serializeForSig(); - var hexSig = _rsasign_getHexPaddedDigestInfoForString(buf.toString(16), 2048, type); + //var hexSig = _rsasign_getHexPaddedDigestInfoForString(buf.toString(16), 2048, type); var hexSig = RSAKey.signWith(buf.toString(16), 2048, type); - var size = hexSig.length / 2; - if (size % 2) size++ + //var size = hexSig.length / 2; + //if (size % 2) size++ var sig = new Buffer(hexSign, 'hex'); } else if (pki_type === 'none') { return this;