Socket
Socket
Sign inDemoInstall

ssl-key-match

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ssl-key-match

Check that RSA key matches SSL certificate and does not require password


Version published
Weekly downloads
127
decreased by-17.53%
Maintainers
1
Install size
859 kB
Created
Weekly downloads
 

Readme

Source

Check that SSL (X509) certificate matches it's private key

This tiny utility uses Open SSL to verify that:

  • input string or file is a valid PEM-encoded X509 certificate
  • input string or file is a valid PEM-encoded RSA private key
  • PEM-encoded X509 certificate matches PEM-encoded private RSA key
  • RSA private key is not encrypted with DES3 (does not require passphrase)

Usage

var ssl = require('ssl-key-match');

var certPem = fs.readFileSync('my-certificate.pem');
var keyPem = fs.readFileSync('my-key.pem');

ssl.match(certPem, keyPem, function(err, matches) {
  if (err)
    return console.error('Something\'s wrong: cert invalid, key invalid, key encrypted or else');
  if (matches)
    console.log('Yay, it matches.');
  else
    console.log('You\'ve picked the wrong key, bro.');
});

// or read directly from files (feeding them to openssl):

ssl.matchFiles('my-certificate.pem', 'my-key.pem', function(err, matches) {
  // ...
});

Keywords

FAQs

Last updated on 16 Jun 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc