summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js')
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js44
1 files changed, 43 insertions, 1 deletions
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js
index d57245cc16..466634c00e 100644
--- a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js
@@ -9,7 +9,8 @@ module.exports = {
countZeros: countZeros,
assertCompatible: assertCompatible,
isCompatible: isCompatible,
- opensslKeyDeriv: opensslKeyDeriv
+ opensslKeyDeriv: opensslKeyDeriv,
+ opensshCipherInfo: opensshCipherInfo
};
var assert = require('assert-plus');
@@ -244,3 +245,44 @@ function addRSAMissing(key) {
key.parts.push(key.part.dmodq);
}
}
+
+function opensshCipherInfo(cipher) {
+ var inf = {};
+ switch (cipher) {
+ case '3des-cbc':
+ inf.keySize = 24;
+ inf.blockSize = 8;
+ inf.opensslName = 'des-ede3-cbc';
+ break;
+ case 'blowfish-cbc':
+ inf.keySize = 16;
+ inf.blockSize = 8;
+ inf.opensslName = 'bf-cbc';
+ break;
+ case 'aes128-cbc':
+ case 'aes128-ctr':
+ case 'aes128-gcm@openssh.com':
+ inf.keySize = 16;
+ inf.blockSize = 16;
+ inf.opensslName = 'aes-128-' + cipher.slice(7, 10);
+ break;
+ case 'aes192-cbc':
+ case 'aes192-ctr':
+ case 'aes192-gcm@openssh.com':
+ inf.keySize = 24;
+ inf.blockSize = 16;
+ inf.opensslName = 'aes-192-' + cipher.slice(7, 10);
+ break;
+ case 'aes256-cbc':
+ case 'aes256-ctr':
+ case 'aes256-gcm@openssh.com':
+ inf.keySize = 32;
+ inf.blockSize = 16;
+ inf.opensslName = 'aes-256-' + cipher.slice(7, 10);
+ break;
+ default:
+ throw (new Error(
+ 'Unsupported openssl cipher "' + cipher + '"'));
+ }
+ return (inf);
+}