@sentinel-one/decrypt-ssh-private
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

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

Package Sidebar

Install

npm i @sentinel-one/decrypt-ssh-private

Weekly Downloads

104

Version

0.0.10

License

BSD

Unpacked Size

60.6 kB

Total Files

21

Last publish

Collaborators

  • zdenek.bednar
  • dmytro.skliarenko
  • danielle_gal
  • anujyadavsentinelone
  • shilpa-s1
  • velsonjr
  • udays1
  • radek_pleskac_s1
  • attilahazay
  • denys-klepikov
  • zlatkos1
  • tanmayid
  • shua.m
  • yuliana.baryskina
  • dans1
  • igorchornyi
  • pavel.skopik
  • janhora
  • npm_service_s1
  • sentinelone
  • assafa
  • ofir.fridman
  • irenav
  • yoni12ab
  • koralbenami
  • liorl3009
  • gal.falah
  • matans
  • jp-s1
  • vovadev
  • yamarbel
  • yoavsc
  • frontend-npm-group
  • maayanb