JWK to SSH in < 100 lines of VanillaJS.
Go to file
AJ ONeal ee84766a61 simplify 2018-12-03 17:14:13 -07:00
README.md v1.0.1: update README 2018-12-02 02:05:13 -07:00
index.html simplify 2018-12-03 17:14:13 -07:00
jwk-to-ssh.js v1.0.0: pack EC and RSA ssh public keys 2018-12-02 01:59:33 -07:00
package.json v1.0.1: update README 2018-12-02 02:05:13 -07:00

README.md

Bluecrypt JWK to SSH (for Browsers)

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

Works for RSA and ECDSA public keys.

Features

< 100 lines of code | < 1.0kb gzipped | 2.0kb minified | 2.9kb with comments

Need SSH Private Keys?

SSH private keys (id_rsa) are just normal PEM files.

Web Demo

https://coolaj86.com/demos/jwk-to-ssh/

git clone https://git.coolaj86.com/coolaj86/bluecrypt-jwk-to-ssh.js
pushd bluecrypt-jwk-to-ssh.js/
open index.html

Install

You can use it as a plain-old javascript library:

<script src="https://git.coolaj86.com/coolaj86/bluecrypt-jwk-to-ssh.js/raw/branch/master/jwk-to-ssh.js"></script>

It's also on npm:

npm install bluecrypt-jwk-to-ssh

Usage

Very simple:

var jwk = {
  "kty": "EC",
  "crv": "P-256",
  "x": "IT1SWLxsacPiE5Z16jkopAn8_-85rMjgyCokrnjDft4",
  "y": "mP2JwOAOdMmXuwpxbKng3KZz27mz-nKWIlXJ3rzSGMo"
};

var pub = SSH.pack({ jwk: jwk, comment: 'root@localhost' });

console.info(pub);

Other Tools in the Bluecrypt Suite

Legal

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

Bluecrypt™ is owned by AJ ONeal