lib/_provisioning/pki.js
function (description, commandArgs, opensslBin, verbosity,
                               input) {
    opensslBin = findOpenSslBin(opensslBin)

    if (verbosity) {
      if (description) {
        console.log(description)
      }
      if (verbosity > 1) {
        console.log("Running openssl. Path: '" + opensslBin +
          "', Command: '" + commandArgs.join(' '))
      }
    }

    var command = childProcess.spawnSync(opensslBin, commandArgs,
      input ? {input: input} : {})
    if (command.stdout && (verbosity > 1)) {
      console.log('OpenSSL OUTPUT LOG: ' + indentedLogOutput(command.stdout))
    }
    if (command.stderr && ((command.status !== 0) || (verbosity > 1))) {
      provisionUtil.logError(indentedLogOutput(command.stderr),
        {header: 'OpenSSL ERROR LOG', verbosity: verbosity})
    }

    if (command.status !== 0) {
      var errorMessage = 'openssl execution failed'
      if (command.error) {
        errorMessage = command.error.message
      }
      if (command.status) {
        errorMessage = errorMessage + ', status code: ' + command.status
      }
      throw provisionUtil.createFormattedDxlError(errorMessage, description)
    }

    return command
  }
function (description, commandArgs, opensslBin, verbosity,
                               input) {
    opensslBin = findOpenSslBin(opensslBin)

    if (verbosity) {
      if (description) {
        console.log(description)
      }
      if (verbosity > 1) {
        console.log("Running openssl. Path: '" + opensslBin +
          "', Command: '" + commandArgs.join(' '))
      }
    }

    var command = childProcess.spawnSync(opensslBin, commandArgs,
      input ? {input: input} : {})
    if (command.stdout && (verbosity > 1)) {
      console.log('OpenSSL OUTPUT LOG: ' + indentedLogOutput(command.stdout))
    }
    if (command.stderr && ((command.status !== 0) || (verbosity > 1))) {
      provisionUtil.logError(indentedLogOutput(command.stderr),
        {header: 'OpenSSL ERROR LOG', verbosity: verbosity})
    }

    if (command.status !== 0) {
      var errorMessage = 'openssl execution failed'
      if (command.error) {
        errorMessage = command.error.message
      }
      if (command.status) {
        errorMessage = errorMessage + ', status code: ' + command.status
      }
      throw provisionUtil.createFormattedDxlError(errorMessage, description)
    }

    return command
  }
function ( description , commandArgs , opensslBin , verbosity , input ) { opensslBin = findOpenSslBin ( opensslBin ) if ( verbosity ) { if ( description ) { console . log ( description ) } if ( verbosity > 1 ) { console . log ( "Running openssl. Path: '" + opensslBin + "', Command: '" + commandArgs . join ( ' ' ) ) } } var command = childProcess . spawnSync ( opensslBin , commandArgs , input ? { input : input } : { } ) if ( command . stdout && ( verbosity > 1 ) ) { console . log ( 'OpenSSL OUTPUT LOG: ' + indentedLogOutput ( command . stdout ) ) } if ( command . stderr && ( ( command . status !== 0 ) || ( verbosity > 1 ) ) ) { provisionUtil . logError ( indentedLogOutput ( command . stderr ) , { header : 'OpenSSL ERROR LOG' , verbosity : verbosity } ) } if ( command . status !== 0 ) { var errorMessage = 'openssl execution failed' if ( command . error ) { errorMessage = command . error . message } if ( command . status ) { errorMessage = errorMessage + ', status code: ' + command . status } throw provisionUtil . createFormattedDxlError ( errorMessage , description ) } return command }
Runs an openssl command.
@param {String} description - Textual description of the HTTP request (used
in log and error messages).
@param {Array<String>} commandArgs - Array of arguments to supply to the
openssl command line.
@param {String} [opensslBin] - Path to the openssl executable. If not
specified, the function attempts to find the openssl executable from the
environment path.
@param {Number} [verbosity] - Level of verbosity at which to log any error
or trace messages.
@param {String} [input] - Optional standard input to provide to the
openssl command.
@returns {Object} Results of the openssl command. The object returned is
from the underlying call to child_process.spawnSync.
@throws {DxlError} If the openssl command fails. A non-zero exit code for
the command is interpreted as failure.
Runs an openssl command .