https://github.com/aleclarson/certpem
https://github.com/aleclarson/certpem
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aleclarson/certpem
- Owner: aleclarson
- License: mit
- Created: 2017-09-20T21:45:23.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-15T07:45:24.000Z (over 7 years ago)
- Last Synced: 2025-01-18T02:44:03.262Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# certpem
Read basic info from a cert.pem / x509 certificate.
### CLI
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.
### Runtime API
```javascript
'use strict';
var certpem = require('certpem').certpem
var cert = fs.readFile('cert.pem', 'ascii', function (err, certstr) {
// basic info
console.info(certpem.info(certstr));
// way too much info
console.info(certpem.debug(certstr));
});
```
Example output:
```javascript
{
"subject": "localhost.daplie.com",
"altnames": [
"localhost.daplie.com"
],
"issuedAt": 1465516800000,
"expiresAt": 1499731199000
}
```
With a few small changes this could also work in the browser (that's how its dependencies are designed).