0.11.0 • Published 2 years ago

node-ssl-certificates v0.11.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm version npm downloads license dependencies quality-all quality popularity

Description

node-ssl-certificates is a node.js library for common ssl-certificates tasks such as fetch, parse and validation.

Features

  • zero third-party dependencies
  • async/await support
  • optional use of node's crypto module
  • asn1 viewer

Installation

npm install --save node-ssl-certificates

Usage

node.js:

'use strict';
 
const sslCertificates = require('node-ssl-certificates')
 
sslCertificates.get('nodejs.org').then(function (certificate) {
  console.log(certificate.issuer)
  // { 
  //   C: 'GB',
  //   ST: 'Greater Manchester',
  //   L: 'Salford',
  //   ....
  // }
});

API Documentation

get

fetch the ssl-certificate from a host, url or local file

const { get } = require('node-ssl-certificates');

await get(from, options);

args

optiondescriptiontypedefault
includeChainincludes chain's certificatesbooleanfalse
includeCertificatesincludes the raw certificates string in the response objectbooleanfalse
useCryptoModuleuse node's crypto module or custom parserbooleantrue
portport to connect toint443
verboseprint verbosebooleanfalse

validate

tests the validity of a ssl-certificate, the aspects tested are

  • Is date valid?
  • Is the domain valid?
  • Is the chain of trust valid?
  • Is the root CA self signed?
  • Was the certificate revoked by it's issuer
  • Are the cryptographic details valid
  • Is the root CA valid?
const { validate } = require('node-ssl-certificates');

await validate(from, options);

args

optiondescriptiontypedefault
domaindomain name to validatestringnull
includeChainincludes chain's certificatesbooleanfalse
useCryptoModuleuse node's crypto module or custom parserbooleantrue
portport to connect toint443
verboseprint verbosebooleanfalse

signedBy

validates a ssl-certificate being signed by some other certificate

const { signedBy } = require('node-ssl-certificates');

await signedBy(from, signer, options);

args

optiondescriptiontypedefault
useCryptoModuleuse node's crypto module or custom parserbooleantrue
verboseprint verbosebooleanfalse

print

print the asn1 tree structure

const { print } = require('node-ssl-certificates');

await printCertificate(from, options);

args

optiondescriptiontypedefault
useCryptoModuleuse node's crypto module or custom parserbooleantrue
verboseprint verbosebooleanfalse

return

  • string: with the asn tree structure

Reference packages

thanks

License

The module is available as open source under the terms of the MIT License.

0.11.0

2 years ago

0.10.2

2 years ago

0.10.1

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago