Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cert-info

coolaj8632.5kMPL-2.01.5.1

Read basic info (subject, altnames, expiresAt, issuedAt) from a cert.pem / x509 certificate (tls / ssl / https)

cert.pem, cert, certificate, x509, subject, altnames, notBefore, notAfter, issuedAt, expiresAt, expired, expires, issued, asn1

readme

cert-info.js

Read basic info from a cert.pem / x509 certificate.

Used for Greenlock.js

Features

| <175 lines of code | 1.7k gzipped | 4.4k minified | 8.8k with comments |

  • <input checked="" disabled="" type="checkbox"> Parses x.509 certificate schemas
    • <input checked="" disabled="" type="checkbox"> DER/ASN.1
    • <input checked="" disabled="" type="checkbox"> PEM (base64-encoded DER)
    • <input checked="" disabled="" type="checkbox"> Subject
    • <input checked="" disabled="" type="checkbox"> SAN extension (altNames)
    • <input checked="" disabled="" type="checkbox"> Issuance Date (notBefore)
    • <input checked="" disabled="" type="checkbox"> Expiry Date (notAfter)
  • <input checked="" disabled="" type="checkbox"> VanillaJS, Zero Dependencies
    • <input checked="" disabled="" type="checkbox"> Node.js
    • <input disabled="" type="checkbox"> Browsers (built, publishing soon)

Install

# bin
npm install --global cert-info

# node.js library
npm install --save cert-info

Usage

CLI

For basic info (subject, altnames, issuedAt, expiresAt):

cert-info /path/to/cert.pem

node.js

'use strict';

var certinfo = require('cert-info');
var cert = fs.readFile('cert.pem', 'ascii', function (err, certstr) {

  // basic info
  console.info(certinfo.info(certstr));

  // if you need to submit a bug report
  console.info(certinfo.debug(certstr));
});

Example output:

{
  "subject": "localhost.example.com",
  "altnames": [
    "localhost.example.com"
  ],
  "issuedAt": 1465516800000,
  "expiresAt": 1499731199000
}

With a few small changes this could also work in the browser (it has no dependencies and all of the non-browser things are on the Enc object).

Legal

cert-info.js | MPL-2.0 | Terms of Use | Privacy Policy