|
|
@ -146,9 +146,7 @@ PayPro.prototype.x509Verify = function() { |
|
|
|
// http://tools.ietf.org/html/rfc5280#section-4.2
|
|
|
|
//
|
|
|
|
var extensions = rfc5280.decodeExtensions(c, { partial: false }); |
|
|
|
var extensionsVerified = !extensions.unknown.filter(function(ext) { |
|
|
|
return ext.critical; |
|
|
|
}).length; |
|
|
|
var extensionsVerified = extensions.verified; |
|
|
|
|
|
|
|
// Object.keys(extensions).forEach(function(key) {
|
|
|
|
// if (extensions[key].execute) {
|
|
|
@ -1078,16 +1076,18 @@ rfc5280.decodeExtensions = function(cert, options) { |
|
|
|
// Parse Extension
|
|
|
|
decoded = ext.schema.decode(edata.extnValue, 'der', options); |
|
|
|
|
|
|
|
// partial: true throws everything onto: { result: ..., errors: ... }
|
|
|
|
if (options.partial && decoded.result) { |
|
|
|
errors = decoded.errors; |
|
|
|
decoded = decoded.result; |
|
|
|
if (Array.isArray(decoded)) { |
|
|
|
decoded = decoded.map(function(decoded) { |
|
|
|
if (Array.isArray(decoded.result)) { |
|
|
|
decoded = decoded.result.map(function(decoded) { |
|
|
|
decoded.errors.forEach(function(error) { |
|
|
|
errors.push(error); |
|
|
|
}); |
|
|
|
return decoded.result; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
decoded = decoded.result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1101,7 +1101,6 @@ rfc5280.decodeExtensions = function(cert, options) { |
|
|
|
// Comment for debugging:
|
|
|
|
// data.edata = edata;
|
|
|
|
// data.ext = ext;
|
|
|
|
data.errors = errors; |
|
|
|
if (ext.parse) { |
|
|
|
data.decoded = decoded; |
|
|
|
} |
|
|
@ -1129,13 +1128,16 @@ rfc5280.decodeExtensions = function(cert, options) { |
|
|
|
} else { |
|
|
|
// Add unknown extension:
|
|
|
|
output.unknown.push(edata); |
|
|
|
output['unkown_' + (output.unknown.length - 1)] = edata; |
|
|
|
|
|
|
|
// XXX Debug
|
|
|
|
print('Unknown extension: %s', eid); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
extensions.verified = !extensions.unknown.filter(function(ext) { |
|
|
|
return ext.critical; |
|
|
|
}).length; |
|
|
|
|
|
|
|
return output; |
|
|
|
}; |
|
|
|
|
|
|
|