JWK to SSH (for node.js)
A minimal library to encode a JWK
as an SSH public key (
Works for RSA and ECDSA public keys.
< 75 lines of code | < 0.7kb gzipped | 1.5kb minified | 2.1kb with comments
- SSH Public Keys
- OpenSSH Private Keys
- RSA Keys
- EC Keys
- P-256 (prime256v1, secp256r1)
- P-384 (secp384r1)
- Browser Version
Note: the file size stats are for v1.0 which did not include private key packing. I plan to go back and update the stats, but just know that it grew a little over 2x.
Need JWK to SSH? PEM to SSH?
Try one of these:
Need Alternate SSH Private Keys?
This library supports OpenSSH private keys.
- Normal PKCS1 / SEC1 / PKCS8
var fs = ;var jwktossh = ;var jwk = JSON;var pub = jwktossh;console;
You can install
jwk-to-ssh and use it from command line:
npm install -g jwk-to-ssh
jwk-to-ssh [keyfile] [comment] [public]
jwk-to-ssh privkey.jwk.json root@localhost
jwk-to-ssh privkey.jwk.json root@localhost public