jwk-to-ssh.js/README.md

70 lines
1.5 KiB
Markdown
Raw Normal View History

# JWK to SSH (for node.js)
A minimal library to encode a JWK
as an SSH public key (`id_rsa.pub`).
Works for RSA and ECDSA public keys.
Features
========
< 75 lines of code | < 0.7kb gzipped | 1.5kb minified | 2.1kb with comments
* [x] SSH Public Keys
* [x] RSA Public Keys
* [x] EC Public Keys
* P-256 (prime256v1, secp256r1)
* P-384 (secp384r1)
* [x] Browser Version
* [Bluecrypt JWK to SSH](https://git.coolaj86.com/coolaj86/bluecrypt-jwk-to-ssh.js)
### Need JWK to SSH? PEM to SSH?
Try one of these:
* [jwk-to-ssh.js](https://git.coolaj86.com/coolaj86/jwk-to-ssh.js) (RSA + EC)
* [Eckles.js](https://git.coolaj86.com/coolaj86/eckles.js) (more EC utils)
* [Rasha.js](https://git.coolaj86.com/coolaj86/eckles.js) (more RSA utils)
### 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 `jwk-to-ssh` and use it from command line:
```bash
npm install -g jwk-to-ssh
```
```bash
jwk-to-ssh pubkey.jwk.json
```
# Usage
You can also use it from JavaScript:
```js
var fs = require('fs');
var jwktossh = require('jwk-to-ssh');
var jwk = JSON.parse(fs.readFileSync("./pubkey.jwk.json"));
var pub = jwktossh.pack({
jwk: jwk
, comment: 'root@localhost'
});
console.info(pub);
```
Legal
-----
[jwk-to-ssh.js](https://git.coolaj86.com/coolaj86/jwk-to-ssh.js) |
MPL-2.0 |
[Terms of Use](https://therootcompany.com/legal/#terms) |
[Privacy Policy](https://therootcompany.com/legal/#privacy)