diff --git a/lib/common.js b/lib/common.js index 4c67d9f..1351d17 100644 --- a/lib/common.js +++ b/lib/common.js @@ -89,13 +89,18 @@ module.exports.fetchFromDisk = function (args) { // stat the file, not the link , fs.statAsync(args.certPath) // 3 ]).then(function (arr) { + var cert = arr[1]; + var getCertInfo = require('./cert-info').getCertInfo; + + // XXX Note: Parsing the certificate info comes at a great cost (~500kb) + var certInfo = getCertInfo(cert); return { key: arr[0] // privkey.pem , privkey: arr[0] // privkey.pem , fullchain: arr[1] + '\n' + arr[2] // fullchain.pem - , cert: arr[1] // cert.pem + , cert: cert // cert.pem , chain: arr[2] // chain.pem , ca: arr[2] // chain.pem @@ -105,7 +110,9 @@ module.exports.fetchFromDisk = function (args) { , certPath: args.certPath , chainPath: args.chainPath - , issuedAt: arr[3].mtime.valueOf() // ??? TODO parse to determine expiresAt and lifetime + //, issuedAt: arr[3].mtime.valueOf() + , issuedAt: Date(certInfo.notBefore.value).valueOf() // Date.now() + , expiresAt: Date(certInfo.notAfter.value).valueOf() , lifetime: args.lifetime }; }, function (err) { diff --git a/lib/core.js b/lib/core.js index e6b673e..969d094 100644 --- a/lib/core.js +++ b/lib/core.js @@ -224,7 +224,7 @@ function writeCertificateAsync(args, defaults, handlers) { }).then(function () { var getCertInfo = require('./cert-info').getCertInfo; - // TODO on memory-constrained systems this is a bad idea + // XXX Note: Parsing the certificate info comes at a great cost (~500kb) var certInfo = getCertInfo(result.cert); return {