# certpem

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

Latest version **1.1.3** (published 2018-12-17) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install certpem
pnpm add certpem
yarn add certpem
bun add certpem
```

Provides the command `certpem`.

## 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.1.3 |
| Published | 2018-12-17 |
| First published | 2016-08-11 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 25.7 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/certpem
- 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/certpem

## Dependencies (2)

- [pkijs](https://npm.io/package/pkijs.md) ^1.3.27
- [asn1js](https://npm.io/package/asn1js.md) ^1.2.12

## Recent versions

- 1.1.3 (latest) — 2018-12-17
- 1.1.2 — 2018-08-17
- 1.1.1 — 2018-08-17
- 1.1.0 — 2018-08-17
- 1.0.1 — 2016-08-11
- 1.0.0 — 2016-08-11

## README

# [certpem.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)

# Install

```bash
# bin
npm install --global certpem

# node.js library
npm install --save certpem
```

# Usage

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

## node.js

```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
  // (requires npm install --save node.extend@1)
  console.info(certpem.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 (that's how its dependencies are designed).

# Legal

[certpem.js](https://git.coolaj86.com/coolaj86/certpem.js) |
MPL-2.0 |
[Terms of Use](https://therootcompany.com/legal/#terms) |
[Privacy Policy](https://therootcompany.com/legal/#privacy)

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