Browse Source

paypro: get single DER certs working.

patch-2
Christopher Jeffrey 11 years ago
parent
commit
f79a31ff3c
  1. 6
      lib/PayPro.js
  2. 6
      lib/browser/PayPro.js

6
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;
}

6
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);

Loading…
Cancel
Save