diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown
index 9fb0e095c02e7b..e4827dbd1b2f33 100644
--- a/doc/api/tls.markdown
+++ b/doc/api/tls.markdown
@@ -809,6 +809,19 @@ See SSL_CIPHER_get_name() and SSL_CIPHER_get_version() in
http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_CIPHERS for more
information.
+### tlsSocket.getEphemeralKeyInfo()
+
+Returns an object representing a type, name and size of parameter of
+an ephemeral key exchange in [Perfect forward Secrecy][] on a client
+connection. It returns an empty object when the key exchange is not
+ephemeral. As it is only supported on a client socket, it returns null
+if this is called on a server socket. The supported types are 'DH' and
+'ECDH'. The `name` property is only available in 'ECDH'.
+
+Example:
+
+ { type: 'ECDH', name: 'prime256v1', size: 256 }
+
### tlsSocket.renegotiate(options, callback)
Initiate TLS renegotiation process. The `options` may contain the following
@@ -887,6 +900,7 @@ The numeric representation of the local port.
[net.Server.address()]: net.html#net_server_address
['secureConnect']: #tls_event_secureconnect
[secureConnection]: #tls_event_secureconnection
+[Perfect Forward Secrecy]: #tls_perfect_forward_secrecy
[Stream]: stream.html#stream_stream
[SSL_METHODS]: http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS
[tls.Server]: #tls_class_tls_server
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index ae88bf6c18ebf6..da2de9814de936 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -628,6 +628,13 @@ TLSSocket.prototype.getCipher = function(err) {
}
};
+TLSSocket.prototype.getEphemeralKeyInfo = function() {
+ if (this._handle)
+ return this._handle.getEphemeralKeyInfo();
+
+ return null;
+};
+
// TODO: support anonymous (nocert) and PSK
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 6d5403b563118f..6e4bf9e69f7106 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -1134,6 +1134,7 @@ void SSLWrap::AddMethods(Environment* env, Local t) {
env->SetProtoMethod(t, "newSessionDone", NewSessionDone);
env->SetProtoMethod(t, "setOCSPResponse", SetOCSPResponse);
env->SetProtoMethod(t, "requestOCSP", RequestOCSP);
+ env->SetProtoMethod(t, "getEphemeralKeyInfo", GetEphemeralKeyInfo);
#ifdef SSL_set_max_send_fragment
env->SetProtoMethod(t, "setMaxSendFragment", SetMaxSendFragment);
@@ -1744,6 +1745,50 @@ void SSLWrap::RequestOCSP(
}
+template
+void SSLWrap::GetEphemeralKeyInfo(
+ const v8::FunctionCallbackInfo& args) {
+ Base* w = Unwrap(args.Holder());
+ Environment* env = Environment::GetCurrent(args);
+
+ CHECK_NE(w->ssl_, nullptr);
+
+ // tmp key is available on only client
+ if (w->is_server())
+ return args.GetReturnValue().SetNull();
+
+ Local