paypro: figure out clientside jsrasign more.
This commit is contained in:
parent
1ad3392184
commit
538c6c32de
|
@ -3,31 +3,11 @@
|
||||||
var Key = require('./Key');
|
var Key = require('./Key');
|
||||||
var x509 = require('./x509');
|
var x509 = require('./x509');
|
||||||
var RSAKey = x509.RSAKey;
|
var RSAKey = x509.RSAKey;
|
||||||
|
var KeyUtil = x509.KEYUTIL;
|
||||||
|
var Signature = x509.crypto.Signature;
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var PayPro = require('../PayPro');
|
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) {
|
PayPro.sign = function(key) {
|
||||||
if (this.messageType !== 'PaymentRequest')
|
if (this.messageType !== 'PaymentRequest')
|
||||||
throw new Error('Signing can only be performed on a 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 pki_data = this.get('pki_data'); // contains one or more x509 certs
|
||||||
var type = pki_type.split('+').toUpperCase();
|
var type = pki_type.split('+').toUpperCase();
|
||||||
var buf = this.serializeForSig();
|
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 hexSig = RSAKey.signWith(buf.toString(16), 2048, type);
|
||||||
var size = hexSig.length / 2;
|
//var size = hexSig.length / 2;
|
||||||
if (size % 2) size++
|
//if (size % 2) size++
|
||||||
var sig = new Buffer(hexSign, 'hex');
|
var sig = new Buffer(hexSign, 'hex');
|
||||||
} else if (pki_type === 'none') {
|
} else if (pki_type === 'none') {
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue