2.0.2 • Published 5 years ago

@nfi/openssl-cmd v2.0.2

Weekly downloads
10
License
ISC
Repository
gitlab
Last release
5 years ago

@nfi/openssl-cmd

npm version pipeline status coverage status standard-js

Basic wrapper for the OpenSSL command-line utility.

Installation

npm install @nfi/openssl-cmd

Usage Example

const { openssl } = require('@nfi/openssl-cmd')

/**
 * Generate a new RSA private key.
 * @param {number} [bits] Optional key size; default 2048.
 * @param {string} [pass] Optional passphrase; unencrypted by default.
 * @returns {Promise<Buffer>} PEM-formatted private key.
*/
async function genpkey(bits, pass) {
  return (await openssl('genpkey')
    .args('-algorithm', 'rsa')
    .argsIf(bits, '-pkeyopt', `rsa_keygen_bits:${bits}`)
    .argsIf(pass, '-pass', `pass:${pass}`, '-aes256')
    .exec()
  ).stdout
}
2.0.2

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago