Browse Source

paypro: account for PEM metadata as per rfc1424.

patch-2
Christopher Jeffrey 10 years ago
parent
commit
9dbe45ad03
  1. 1
      browser/root-certs
  2. 2
      lib/common/PayPro.js
  3. 1
      lib/common/RootCerts.js

1
browser/root-certs

@ -49,6 +49,7 @@ function getRootCerts(callback) {
+ ' pem = pem + "";\n'
+ ' pem = pem.replace(/-----BEGIN CERTIFICATE-----/g, "");\n'
+ ' pem = pem.replace(/-----END CERTIFICATE-----/g, "");\n'
+ ' pem = pem.trim().split(/(?:\\r?\\n){2,}/).pop();'
+ ' pem = pem.replace(/\\s+/g, "");\n'
+ ' if (!Object.prototype.hasOwnProperty.call(trusted, pem)) return;\n'
+ ' return trusted[pem];\n'

2
lib/common/PayPro.js

@ -399,7 +399,7 @@ PayPro.prototype._DERtoPEM = function(der, type) {
if (typeof der === 'string') {
der = new Buffer(der, 'hex');
}
var type = type || 'UNKNOWN';
var type = type || 'PRIVACY-ENHANCED MESSAGE';
der = der.toString('base64');
der = der.replace(/(.{64})/g, '$1\r\n');
der = der.replace(/\r\n$/, '');

1
lib/common/RootCerts.js

@ -3718,6 +3718,7 @@ function getTrusted(pem) {
pem = pem + "";
pem = pem.replace(/-----BEGIN CERTIFICATE-----/g, "");
pem = pem.replace(/-----END CERTIFICATE-----/g, "");
pem = pem.trim().split(/(?:\r?\n){2,}/).pop();
pem = pem.replace(/\s+/g, "");
if (!Object.prototype.hasOwnProperty.call(trusted, pem)) return;
return trusted[pem];

Loading…
Cancel
Save