allow specifying cert path
This commit is contained in:
parent
f06d25ab22
commit
815c569674
|
@ -62,20 +62,20 @@ certInfo.getCertInfoFromFile = function (pemFile) {
|
||||||
return require('fs').readFileSync(pemFile, 'ascii');
|
return require('fs').readFileSync(pemFile, 'ascii');
|
||||||
};
|
};
|
||||||
|
|
||||||
certInfo.testGetCertInfo = function () {
|
certInfo.testGetCertInfo = function (pathname) {
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var pemFile = path.join(__dirname, '..', 'tests', 'example.cert.pem');
|
var pemFile = pathname || path.join(__dirname, '..', 'tests', 'example.cert.pem');
|
||||||
return certInfo.getCertInfo(certInfo.getCertInfoFromFile(pemFile));
|
return certInfo.getCertInfo(certInfo.getCertInfoFromFile(pemFile));
|
||||||
};
|
};
|
||||||
|
|
||||||
certInfo.testBasicCertInfo = function () {
|
certInfo.testBasicCertInfo = function (pathname) {
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var pemFile = path.join(__dirname, '..', 'tests', 'example.cert.pem');
|
var pemFile = pathname || path.join(__dirname, '..', 'tests', 'example.cert.pem');
|
||||||
return certInfo.getBasicInfo(certInfo.getCertInfoFromFile(pemFile));
|
return certInfo.getBasicInfo(certInfo.getCertInfoFromFile(pemFile));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
var c = certInfo.testGetCertInfo();
|
var c = certInfo.testGetCertInfo(process.argv[2]);
|
||||||
|
|
||||||
console.info('');
|
console.info('');
|
||||||
|
|
||||||
|
@ -88,4 +88,9 @@ if (require.main === module) {
|
||||||
console.info(new Date(c.notAfter.value).valueOf());
|
console.info(new Date(c.notAfter.value).valueOf());
|
||||||
|
|
||||||
console.info('');
|
console.info('');
|
||||||
|
|
||||||
|
var b = certInfo.testBasicCertInfo(process.argv[2]);
|
||||||
|
console.info('');
|
||||||
|
console.info(JSON.stringify(b, null, ' '));
|
||||||
|
console.info('');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue