GithubHelp home page GithubHelp logo

cert-info.js's Introduction

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).

Legal

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

cert-info.js's People

Contributors

dylannlaw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.