1.0.2 • Published 5 years ago

greenlock-ssh-fingerprint v1.0.2

Weekly downloads
3
License
MPL-2.0
Repository
-
Last release
5 years ago

SSH Fingerprint (for node.js)

A minimal library to read an SSH public key (id_rsa.pub) and generate its fingerprint.

Works for RSA and ECDSA public keys.

Features

< 125 lines of code | <1kb gzipped | 2.0kb minified | 3.5kb with comments

  • SSH Public Key SHA256 Fingerprints
    • RSA (2048-bit, 3072-bit, 4096-bit)
    • EC / ECDSA
      • P-256 (prime256v1, secp256r1)
      • P-384 (secp384r1)
  • Browser Version

CLI

You can install ssh-fingerprint and use it from command line:

npm install -g greenlock-ssh-fingerprint
ssh-fingerprint ~/.ssh/id_rsa.pub
2048 SHA256:yCB62vBVsOwqksgYwy/WDbaMF2PhPijAwcrlzmrxfko root@localhost (RSA)

(the output is the same as ssh-keygen -lf ~/.ssh/id_rsa.pub)

Usage

You can also use it from JavaScript:

SSH Fingerprint

var fs = require('fs');
var SSH = require('greenlock-ssh-fingerprint');
var pub = fs.readFileSync("./id_rsa.pub");

SSH.fingerprint({ pub: pub }).then(function (fing) {
  console.info('The key fingerprint is:');
  console.info(fing.fingerprint, fing.comment);
  // SHA256:yCB62vBVsOwqksgYwy/WDbaMF2PhPijAwcrlzmrxfko root@localhost
});

Legal

ssh-fingerprint.js | MPL-2.0 | Terms of Use | Privacy Policy