add subject, altnames to cert-info
This commit is contained in:
parent
815c569674
commit
dad5aca9ff
|
@ -51,10 +51,14 @@ certInfo.getBasicInfo = function (pem) {
|
|||
sub = c.subject.types_and_values[0].value.value_block.value || null;
|
||||
|
||||
return {
|
||||
issuedAt: c.notBefore.value
|
||||
, expiresAt: c.notAfter.value
|
||||
, domains: domains
|
||||
, subject: sub
|
||||
subject: sub
|
||||
, altnames: domains
|
||||
// for debugging during console.log
|
||||
// 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()
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -8,13 +8,14 @@ var PromiseA = require('bluebird');
|
|||
var dns = PromiseA.promisifyAll(require('dns'));
|
||||
|
||||
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)
|
||||
var certInfo = getCertInfo(results.cert);
|
||||
|
||||
//results.issuedAt = arr[3].mtime.valueOf()
|
||||
results.issuedAt = Date(certInfo.notBefore.value).valueOf(); // Date.now()
|
||||
results.expiresAt = Date(certInfo.notAfter.value).valueOf();
|
||||
// subject, altnames, issuedAt, expiresAt
|
||||
Object.keys(certInfo).forEach(function (key) {
|
||||
results[key] = certInfo[key];
|
||||
});
|
||||
|
||||
return results;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue