summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin')
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv16
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-sign17
2 files changed, 30 insertions, 3 deletions
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
index 8eec411ffb..a1205a45d5 100755
--- a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
@@ -7,6 +7,9 @@ var dashdash = require('dashdash');
var sshpk = require('../lib/index');
var fs = require('fs');
var path = require('path');
+var tty = require('tty');
+var readline = require('readline');
+var getPassword = require('getpass').getPass;
var options = [
{
@@ -131,7 +134,9 @@ if (require.main === module) {
while ((data = inFile.read()))
bufs.push(data);
});
- inFile.on('end', function () {
+ var parseOpts = {};
+ parseOpts.filename = inFileName;
+ inFile.on('end', function processKey() {
var buf = Buffer.concat(bufs);
var fmt = 'auto';
if (opts.informat)
@@ -140,8 +145,15 @@ if (require.main === module) {
if (opts.private)
f = sshpk.parsePrivateKey;
try {
- var key = f(buf, fmt, inFileName);
+ var key = f(buf, fmt, parseOpts);
} catch (e) {
+ if (e.name === 'KeyEncryptedError') {
+ getPassword(function (err, pw) {
+ parseOpts.passphrase = pw;
+ processKey();
+ });
+ return;
+ }
console.error('sshpk-conv: ' +
e.name + ': ' + e.message);
process.exit(1);
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-sign b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-sign
index c8b91932aa..673fc98642 100755
--- a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-sign
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-sign
@@ -7,6 +7,7 @@ var dashdash = require('dashdash');
var sshpk = require('../lib/index');
var fs = require('fs');
var path = require('path');
+var getPassword = require('getpass').getPass;
var options = [
{
@@ -51,6 +52,8 @@ var options = [
}
];
+var parseOpts = {};
+
if (require.main === module) {
var parser = dashdash.createParser({
options: options
@@ -79,11 +82,23 @@ if (require.main === module) {
}
var keyData = fs.readFileSync(opts.identity);
+ parseOpts.filename = opts.identity;
+
+ run();
+}
+function run() {
var key;
try {
- key = sshpk.parsePrivateKey(keyData);
+ key = sshpk.parsePrivateKey(keyData, 'auto', parseOpts);
} catch (e) {
+ if (e.name === 'KeyEncryptedError') {
+ getPassword(function (err, pw) {
+ parseOpts.passphrase = pw;
+ run();
+ });
+ return;
+ }
console.error('sshpk-sign: error loading private key "' +
opts.identity + '": ' + e.name + ': ' + e.message);
process.exit(1);