0.0.10 • Published 3 years ago

@sentinel-one/decrypt-ssh-private v0.0.10

Weekly downloads
-
License
BSD
Repository
github
Last release
3 years ago

decrypt-ssh-private

npm version License Node.js CI

A TS library that decrypts ssh keys in the browser.

Based on the nodejs node-sshpk and uses forge where possible.

Credit:

The authors of node-sshpk.

Special thanks to Ido Kotler (Sentinelone Innovative security researcher) for technical guidance and help in implementation 💣.

API:

import { decryptPrivateSSHKey } from '../lib/main';
import { ErrorClassification, ResultT } from '../lib/error-classifier';

const result: ResultT<ErrorClassification, string> = decryptPrivateSSHKey(encryptedSSHKey, { passphrase: '123456' });
result
  .ok((output: string) => {
    console.log(output);
    return result;
  })
  .err((err: ErrorClassification) => {
    // do something with the classified error
    console.log(err);
    return result;
  });

Util functions

  • isValidSSHKey(pem: string): boolean // Checks that a given PEM format is valid or not
if (isValidSSHKey('invalid key')) {
  // do sothing
};

To see it decrypts in the browser just build and serve the example:

esbuild-browser && npx http-server

Contributers

Liron Hazan

Vova Shabun

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago