cert-info.js/README.md

61 lines
946 B
Markdown
Raw Normal View History

2016-08-11 09:43:11 -06:00
cert-info.js
============
2016-08-11 09:15:10 -06:00
Read basic info from a cert.pem / x509 certificate.
2016-08-11 09:43:11 -06:00
Install
=======
```bash
# bin
npm install --global certpem
# node.js library
npm install --save certpem
```
Usage
=====
2016-08-11 10:06:11 -06:00
CLI
---
2016-08-11 09:43:11 -06:00
For basic info (subject, altnames, issuedAt, expiresAt):
```bash
certpem /path/to/cert.pem
```
Output all info by passing `--debug` or use `--json` to see the basic info pretty-printed.
2016-08-11 10:06:11 -06:00
node.js
-------
2016-08-11 09:43:11 -06:00
```javascript
'use strict';
var certpem = require('certpem').certpem
var cert = fs.readFile('cert.pem', 'ascii', function (err, certstr) {
2016-08-11 10:01:24 -06:00
// basic info
console.info(certpem.info());
// way too much info
console.info(certpem.debug());
2016-08-11 09:43:11 -06:00
});
```
```javascript
{
"subject": "localhost.daplie.com",
"altnames": [
"localhost.daplie.com"
],
"issuedAt": 1465516800000,
"expiresAt": 1499731199000
}
```
2016-08-11 10:06:11 -06:00
With a few small changes this could also work in the browser (that's how its dependencies are designed).