Socket
Socket
Sign inDemoInstall

cert-info

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cert-info

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


Version published
Weekly downloads
11K
decreased by-27.36%
Maintainers
1
Install size
32.4 kB
Created
Weekly downloads
 

Readme

Source

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 |

  • Parses x.509 certificate schemas
    • DER/ASN.1
    • PEM (base64-encoded DER)
    • Subject
    • SAN extension (altNames)
    • Issuance Date (notBefore)
    • Expiry Date (notAfter)
  • VanillaJS, Zero Dependencies
    • Node.js
    • 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).

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

Keywords

FAQs

Last updated on 02 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc