Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

x509

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

x509 - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

36

index.js

@@ -1,3 +0,3 @@

var x509 = require('./build/Release/x509');
var fs = require('fs');

@@ -9,2 +9,34 @@ exports.version = x509.version;

exports.verify = function(certPath, CABundlePath, cb) {
if (!certPath) {
throw new TypeError('Certificate path is required');
}
if (!CABundlePath) {
throw new TypeError('CA Bundle path is required');
}
fs.stat(certPath, function(certPathErr) {
if (certPathErr) {
return cb(certPathErr);
}
fs.stat(CABundlePath, function(bundlePathErr) {
if (bundlePathErr) {
return cb(bundlePathErr);
}
try {
x509.verify(certPath, CABundlePath);
cb(null);
}
catch (verificationError) {
cb(verificationError);
}
});
});
};
exports.parseCert = function(path) {

@@ -21,2 +53,2 @@ var ret = x509.parseCert(path);

return ret;
};
};

2

package.json
{
"name": "x509",
"version": "0.2.6",
"version": "0.3.0",
"description": "Simple X509 certificate parser.",

@@ -5,0 +5,0 @@ "author": "Colton Baker",

@@ -88,3 +88,3 @@ node-x509

/*
cert = { subject:
cert = { subject:
{ countryName: 'US',

@@ -98,3 +98,3 @@ postalCode: '10010',

commonName: '*.nodejitsu.com' },
issuer:
issuer:
{ countryName: 'GB',

@@ -117,2 +117,27 @@ stateOrProvinceName: 'Greater Manchester',

#### x509.verify(`cert`, `CABundlePath`, function(err, result){ /*...*/})
Performs basic certificate validation against a bundle of ca certificates.
It accepts an error-first callback as first argument. If the error is null, then
the certificate is valid.
The error messages are the same returned by openssl: [x509_verify_cert_error_string](https://www.openssl.org/docs/manmaster/crypto/X509_STORE_CTX_get_error.html)
**Note:**
As now, this function only accepts absolute paths to existing files as arguments
```js
const x509 = require('x509');
x509.verify(
__dirname + '/certs/user.com.crt',
__dirname + 'enduser-example.com.chain',
function(err, result){ /*...*/}
);
```
## Examples

@@ -119,0 +144,0 @@ Checking the date to make sure the certificate is active:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc