# cert-info

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

Latest version **1.5.1** (published 2019-03-02) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install cert-info
pnpm add cert-info
yarn add cert-info
bun add cert-info
```

Provides the command `cert-info`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2019-03-02 |
| First published | 2018-12-17 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 31.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AJ ONeal |
| Maintainers | coolaj86 |
| Keywords | cert.pem, cert, certificate, x509, subject, altnames, notBefore, notAfter, issuedAt, expiresAt, expired, expires, issued, asn1 |

## Links

- npm: https://www.npmjs.com/package/cert-info
- Repository: https://git.coolaj86.com/coolaj86/cert-info.js
- Issues: https://git.coolaj86.com/coolaj86/cert-info.js/issues
- npm.io page: https://npm.io/package/cert-info

## Recent versions

- 1.5.1 (latest) — 2019-03-02
- 1.5.0 — 2018-12-17

## README

# [cert-info.js](https://git.coolaj86.com/coolaj86/cert-info.js)

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

Used for [Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock-express.js)

# Features

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

* [x] Parses x.509 certificate schemas
  * [x] DER/ASN.1
  * [x] PEM (base64-encoded DER)
  * [x] Subject
  * [x] SAN extension (altNames)
  * [x] Issuance Date (notBefore)
  * [x] Expiry Date (notAfter)
* [x] VanillaJS, **Zero Dependencies**
  * [x] Node.js
  * [ ] Browsers (built, publishing soon)

# Install

```bash
# bin
npm install --global cert-info

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

# Usage

## CLI

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

```bash
cert-info /path/to/cert.pem
```

## node.js

```javascript
'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:

```javascript
{
  "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](https://git.coolaj86.com/coolaj86/cert-info.js) |
MPL-2.0 |
[Terms of Use](https://therootcompany.com/legal/#terms) |
[Privacy Policy](https://therootcompany.com/legal/#privacy)

---
_Source: https://npm.io/package/cert-info · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
