module.exports.ciphers = ['aes128', 'aes192', 'aes256', 'camellia128', 'camellia192', 'camellia256', 'des', 'des3', 'idea']
var ciphers = module.exports.ciphers
module.exports.createPasswordFile = function (options, params, PasswordFileArray) {
if (!options || !Object.prototype.hasOwnProperty.call(options, 'password') || !Object.prototype.hasOwnProperty.call(options, 'passType') || !/^(word|in|out)$/.test(options.passType)) {
return false
}
var PasswordFile = pathlib.join(tempDir, crypto.randomBytes(20).toString('hex'))
PasswordFileArray.push(PasswordFile)
options.password = options.password.trim()
if (options.password === '') {
options.mustPass = true
}
if (options.cipher && (ciphers.indexOf(options.cipher) !== -1)) {
params.push('-' + options.cipher)
}
params.push('-pass' + options.passType)
if (options.mustPass) {
params.push('pass:' + options.password)
} else {
fs.writeFileSync(PasswordFile, options.password)
params.push('file:' + PasswordFile)
}
return true
}
module.exports.deleteTempFiles = function (files, callback) {
var rmFiles = []
if (typeof files === 'string') {
rmFiles.push(files)
} else if (Array.isArray(files)) {
rmFiles = files
} else {
return callback(new Error('Unexcepted files parameter type; only string or array supported'))
}
var deleteSeries = function (list, finalCallback) {
if (list.length) {
var file = list.shift()
var myCallback = function (err) {
if (err && err.code === 'ENOENT') {