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,EAAY,EAAS,EAAK,MACvB,EAAS,KAAM,EAAK,KAAO,EAAK,IACzC,GACF,EAKA,IAAI,MAAQ,SAAS,EAAM,EAAa,GACtC,IAAI,EAAM,KAAK,OACb,6DACA,EACA,GAEF,IAAI,YAAY,GAAK,SAAS,GAC5B,GAAI,EAAO,OAAO,EAAS,GAC3B,EAAS,KACX,GACF,EAKA,QAAQ,OAAS,SAAS,EAAQ,EAAM,GACtC,IAAI,EAAM,KAAK,OAAO,+BAAgC,EAAQ,GAE9D,IAAI,YAAY,GAAK,SAAS,EAAO,EAAQ,GAC3C,GAAI,GAAS,EAAQ,OAAO,EAAS,GAAS,EAAQ,MAKtD,IAHA,IAAI,EAAY,EACZ,EAAQ,EAAO,QAAQ,MAEpB,GAAS,GAAG,CACjB,IAAI,EAAO,EAAU,UAAU,EAAG,GAKlC,GAJA,EAAY,EAAU,UAAU,EAAQ,GACxC,EAAQ,EAAK,QAAQ,KAGH,UAFF,EAAK,UAAU,EAAG,GAGhC,OAAO,EAAS,EAAM,MAGxB,EAAQ,EAAU,QAAQ,KAC5B,CAEA,EAAS,KAAM,EACjB,GACF","file":"/npm/ssl@1.0.0/ssl.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ssl@1.0.0/ssl.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","//\n//     SSL\n//     Verify SSL certificates; convert files; remove passcode from\n//        private keys.\n//     Copyright(c) 2013 Modulus <feedback@modulus.io>\n//     MIT Licensed\n//\n\nvar fs = require('fs')\n  , exec = require('child_process').exec\n  , path = require('path')\n  , util = require('util');\n\nvar ssl = exports;\n\n//\n// Execute the specified command using the specified callback.\n//\nssl._runCommand = function(cmd, fn) {\n  exec(cmd, fn);\n};\n\n//\n// Removes a passphrase from a private key and overwrites the original file\n//    with the new file.\n//\nssl.removePassphrase = function(file, pass, opts, callback) {\n  if (typeof opts === 'function') {\n    callback = opts;\n    opts = {};\n  }\n\n  opts.newKeyName = opts.newKeyName || 'newPrivteKey.pem';\n  opts.informExt = opts.informExt || 'PEM';\n  opts.outformExt = opts.outformExt || 'PEM';\n\n  var cmd = util.format(\n    'openssl rsa -passin pass:%s -inform %s -in %s -outform %s -out',\n    pass,\n    opts.informExt,\n    file,\n    opts.outformExt,\n    opts.newKeyName);\n\n  ssl._runCommand(cmd, function(error) {\n    if (error) return callback(error);\n\n    fs.readFile(opts.newKeyName, function(err, data) {\n      if (err) return callback(err);\n      fs.writeFile(file, data, function(err) {\n        if (err) return callback(err);\n\n        callback(null);\n      });\n    });\n  });\n};\n\n//\n// Convert a .pem file to a .der file.\n//\nssl.toDer = function(file, derFileName, callback) {\n  var cmd = util.format(\n    'openssl x509 -in %s -outform der -out %s',\n    file,\n    derFileName);\n\n  ssl._runCommand(cmd, function(error) {\n    if (error) return callback(error);\n    callback(null);\n  });\n};\n\n//\n// Saves a string representation of a key to a file. Specify the file and\n//    location using options `folderName`, `name`, and `ext`.\n//\nssl.toFile = function(string, opts, callback) {\n  if (typeof opts === 'function') {\n    callback = opts;\n    opts = {};\n  }\n\n  opts.folderName = opts.folderName || 'temp';\n  opts.name = opts.name || 'temp';\n  opts.ext = opts.ext || '.pem';\n\n  var dirPath = path.resolve(opts.folderName);\n  if (!fs.existsSync(dirPath)) fs.mkdirSync(dirPath);\n\n  fs.writeFile(opts.folderName + '/' + opts.name + opts.ext, string, function(err) {\n    if (err) return callback(err, null);\n    return callback(null, opts.name + opts.ext);\n  });\n};\n\n//\n// Convert the specified file to a .pem file with the specified name.\n//\nssl.toPem = function(file, pemFileName, callback) {\n  var cmd = util.format(\n    'openssl x509 -in %s -inform der -text -outform pem -out %s',\n    file,\n    pemFileName);\n\n  ssl._runCommand(cmd, function(error) {\n    if (error) return callback(error);\n    callback(null);\n  });\n};\n\n//\n// Verifies the validity of the specified .PEM certificate.\n//\nexports.verify = function(caFile, file, callback) {\n  var cmd = util.format('openssl verify -CAfile %s %s', caFile, file);\n\n  ssl._runCommand(cmd, function(error, stdout, stderr) {\n    if (error || stderr) return callback(error || stderr, null);\n\n    var remaining = stdout;\n    var index = stdout.indexOf('\\n');\n\n    while (index > -1) {\n      var line = remaining.substring(0, index);\n      remaining = remaining.substring(index + 1);\n      index = line.indexOf(' ');\n      var firstWord = line.substring(0, index);\n\n      if (firstWord === 'error') {\n        return callback(line, null);\n      }\n\n      index = remaining.indexOf('\\n');\n    }\n\n    callback(null, stdout);\n  });\n};\n"]}