Skip to content

psotres/openssl-verify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSSL Certificate validation utility

A wrapper around OpenSSL commands to allow certificate validation for Node.js

Usage

Install with npm: npm install openssl-verify --save

var openssl = require('openssl-verify');
var fs = require('fs');

var certificate = fs.readFileSync('certificate.pem', "utf8");

openssl.verifyCertificate(certificate, 'resources/cafolder', function(result) {
        console.log(result);
})

API

verifyCertificate(cert, caDir, caFile, cb)

Checks the validity of a provided certificate, and wheter or not it is trusted by any CA present in caDir.

  • cert: String contents of the certificate (PEM encoded)
  • caDir: String folder with trusted CA's
  • caFile: String file of trusted CA's
  • cb: Function in the form of function(err, result) where result is an object containing boolean flags validCert, verifiedCA and expired; as well as output containing the raw output from OpenSSL. Those flags are evaluated in order, so if one of them is false the rest won't be included (they would be meaningless)

About

A wrapper around OpenSSL commands to allow certificate validation for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published