add subject, altnames to cert-info

This commit is contained in:
AJ ONeal 2016-08-09 15:19:29 -04:00
parent 815c569674
commit dad5aca9ff
2 changed files with 13 additions and 8 deletions

View File

@ -51,10 +51,14 @@ certInfo.getBasicInfo = function (pem) {
sub = c.subject.types_and_values[0].value.value_block.value || null; sub = c.subject.types_and_values[0].value.value_block.value || null;
return { return {
issuedAt: c.notBefore.value subject: sub
, expiresAt: c.notAfter.value , altnames: domains
, domains: domains // for debugging during console.log
, subject: sub // do not expect these values to be here
, _issuedAt: c.notBefore.value
, _expiresAt: c.notAfter.value
, issuedAt: new Date(c.notBefore.value).valueOf()
, expiresAt: new Date(c.notAfter.value).valueOf()
}; };
}; };

View File

@ -8,13 +8,14 @@ var PromiseA = require('bluebird');
var dns = PromiseA.promisifyAll(require('dns')); var dns = PromiseA.promisifyAll(require('dns'));
module.exports.attachCertInfo = function (results) { module.exports.attachCertInfo = function (results) {
var getCertInfo = require('./cert-info').getCertInfo; var getCertInfo = require('./cert-info').getBasicInfo;
// XXX Note: Parsing the certificate info comes at a great cost (~500kb) // XXX Note: Parsing the certificate info comes at a great cost (~500kb)
var certInfo = getCertInfo(results.cert); var certInfo = getCertInfo(results.cert);
//results.issuedAt = arr[3].mtime.valueOf() // subject, altnames, issuedAt, expiresAt
results.issuedAt = Date(certInfo.notBefore.value).valueOf(); // Date.now() Object.keys(certInfo).forEach(function (key) {
results.expiresAt = Date(certInfo.notAfter.value).valueOf(); results[key] = certInfo[key];
});
return results; return results;
}; };