💯 SSH Fingerprint in a lightweight, zero-dependency VanillaJS node library.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AJ ONeal 6b6fd5e01d v1.1.0: add ssh fingerprint 1 year ago
bin v1.1.0: add ssh fingerprint 1 year ago
lib v1.1.0: add ssh fingerprint 1 year ago
README.md v1.1.0: add ssh fingerprint 1 year ago
index.js v1.0.0: parse EC and RSA ssh public keys 1 year ago
package.json v1.1.0: add ssh fingerprint 1 year ago

README.md

SSH to JWK (for node.js)

A minimal library to parse an SSH public key (id_rsa.pub) and convert it into a public JWK.

Works for RSA and ECDSA public keys.

Features

< 100 lines of code | <1kb gzipped | 1.8kb minified | 3.1kb with comments

  • SSH Public Keys
    • fingerprint
  • RSA Public Keys
  • EC Public Keys
    • P-256 (prime256v1, secp256r1)
    • P-384 (secp384r1)
  • Browser Version

Need JWK to SSH? SSH to PEM?

Try one of these:

Need SSH Private Keys?

SSH private keys are just normal PEM files, so you can use Eckles or Rasha, as mentioned above.

CLI

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

npm install -g ssh-to-jwk
ssh-to-jwk ~/.ssh/id_rsa.pub

Usage

You can also use it from JavaScript:

SSH to JWK

var fs = require('fs');
var sshtojwk = require('ssh-to-jwk');

var pub = fs.readFileSync("./id_rsa.pub");
var ssh = sshtojwk.parse({ pub: pub });

console.info(ssh.jwk);

SSH Fingerprint

var fs = require('fs');
var sshtojwk = require('ssh-to-jwk');
var pub = fs.readFileSync("./id_rsa.pub");

sshtojwk.fingerprint({ pub: pub }).then(function (fingerprint) {
  console.info(fingerprint);
  // SHA256:yCB62vBVsOwqksgYwy/WDbaMF2PhPijAwcrlzmrxfko
});

Legal

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