Skip to content

JacobEberhardt/OpenSSHPubKeyParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSSHPubKeyParser

This is a little utility, which parses OpenSSH RSA public keys in pure javascript and returns modulus n and exponent e.

It can be applied to parse public keys generated for example by the ssh-keygen command line tool:

ssh-keygen -t rsa -b 4096 -C "some comment"

The implementation is based on http://blog.oddbit.com/2011/05/08/converting-openssh-public-keys/ and https://github.com/PatrickRoumanoff/js-keygen

Use as Node.js module

Simply install the npm package:

npm i opensshpubkeyparser

and require the module:

var parser = require('opensshpubkeyparser');

An example can be found in node_sample.js. Before running it, make sure to execute npm install in the root directory containing package.json to resolve required devDependencies. To run the example, simply execute npm start.

Use in Browser

For in-browser use, simply import the parser.js file from html and remove the first line from the parser.js file:

module.exports = {parsePublicKey};

An example can be found in index.html.

About

Parses OpenSSH RSA Public Keys and returns modulus n and exponent e

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published