lib/_provisioning/pki.js
function findOpenSslBin (opensslBin) {
  if (opensslBin) {
    if (!fs.existsSync(opensslBin)) {
      throw new DxlError('Unable to find openssl at: ' + opensslBin)
    }
  } else {
    opensslBin = which.sync('openssl', {nothrow: true})
    if (!opensslBin && (os.platform() === 'win32')) {
      opensslBin = DEFAULT_OPENSSL_WIN32_INSTALL_DIRS.reduce(
        function (acc, candidatePath) {
          candidatePath = path.join(candidatePath, 'openssl.exe')
          if (!acc && fs.existsSync(candidatePath)) {
            acc = candidatePath
          }
          return acc
        },
        null
      )
    }
    if (!opensslBin) {
      throw new DxlError('Unable to find openssl from system path')
    }
  }
  return opensslBin
}
function findOpenSslBin (opensslBin) {
  if (opensslBin) {
    if (!fs.existsSync(opensslBin)) {
      throw new DxlError('Unable to find openssl at: ' + opensslBin)
    }
  } else {
    opensslBin = which.sync('openssl', {nothrow: true})
    if (!opensslBin && (os.platform() === 'win32')) {
      opensslBin = DEFAULT_OPENSSL_WIN32_INSTALL_DIRS.reduce(
        function (acc, candidatePath) {
          candidatePath = path.join(candidatePath, 'openssl.exe')
          if (!acc && fs.existsSync(candidatePath)) {
            acc = candidatePath
          }
          return acc
        },
        null
      )
    }
    if (!opensslBin) {
      throw new DxlError('Unable to find openssl from system path')
    }
  }
  return opensslBin
}
function findOpenSslBin ( opensslBin ) { if ( opensslBin ) { if ( ! fs . existsSync ( opensslBin ) ) { throw new DxlError ( 'Unable to find openssl at: ' + opensslBin ) } } else { opensslBin = which . sync ( 'openssl' , { nothrow : true } ) if ( ! opensslBin && ( os . platform ( ) === 'win32' ) ) { opensslBin = DEFAULT_OPENSSL_WIN32_INSTALL_DIRS . reduce ( function ( acc , candidatePath ) { candidatePath = path . join ( candidatePath , 'openssl.exe' ) if ( ! acc && fs . existsSync ( candidatePath ) ) { acc = candidatePath } return acc } , null ) } if ( ! opensslBin ) { throw new DxlError ( 'Unable to find openssl from system path' ) } } return opensslBin }
Returns the first location found for the openssl executable.
@param {String} [opensslBin=null] - If non-null and the named file exists,
this value is returned.
@returns {String} Path to the openssl executable.
@throws {DxlError} If openssl cannot be found.
Returns the first location found for the openssl executable .