openssl-verify
v0.3.0
Published
OpenSSL wrapper to validate X.509 certificates
Downloads
18
Readme
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 offunction(err, result)
whereresult
is an object containing boolean flagsvalidCert
,verifiedCA
andexpired
; as well asoutput
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)