aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkoichik <koichik@improvement.jp>2011-10-27 02:34:56 +0900
committerkoichik <koichik@improvement.jp>2011-10-31 17:36:43 +0900
commitf53d092a2a981bebc0cf07d00709dd1433453d7d (patch)
tree37e087f83a73f795ef530c463ef1fe87239b92f4 /lib
parentb6c582a3a31a9e53bed4f960e35b89d700985640 (diff)
downloadandroid-node-v8-f53d092a2a981bebc0cf07d00709dd1433453d7d.tar.gz
android-node-v8-f53d092a2a981bebc0cf07d00709dd1433453d7d.tar.bz2
android-node-v8-f53d092a2a981bebc0cf07d00709dd1433453d7d.zip
tls, https: add passphrase option
Fixes #1925.
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto.js8
-rw-r--r--lib/tls.js2
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 85bbbcd65c..6244f2c8d4 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -76,7 +76,13 @@ exports.createCredentials = function(options, context) {
if (context) return c;
- if (options.key) c.context.setKey(options.key);
+ if (options.key) {
+ if (options.passphrase) {
+ c.context.setKey(options.key, options.passphrase);
+ } else {
+ c.context.setKey(options.key);
+ }
+ }
if (options.cert) c.context.setCert(options.cert);
diff --git a/lib/tls.js b/lib/tls.js
index 35da95bc43..21bb2af072 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -846,6 +846,7 @@ function Server(/* [options], listener */) {
var sharedCreds = crypto.createCredentials({
key: self.key,
+ passphrase: self.passphrase,
cert: self.cert,
ca: self.ca,
ciphers: self.ciphers,
@@ -928,6 +929,7 @@ Server.prototype.setOptions = function(options) {
}
if (options.key) this.key = options.key;
+ if (options.passphrase) this.passphrase = options.passphrase;
if (options.cert) this.cert = options.cert;
if (options.ca) this.ca = options.ca;
if (options.secureProtocol) this.secureProtocol = options.secureProtocol;