@@ -62,6 +62,12 @@ static const int X509_NAME_FLAGS = ASN1_STRFLGS_ESC_CTRL
6262 | XN_FLAG_SEP_MULTILINE
6363 | XN_FLAG_FN_SN;
6464
65+ #define DEFAULT_CIPHER_LIST_V10_38 " ECDHE-RSA-AES128-SHA256:" \
66+ " AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH"
67+
68+ #define DEFAULT_CIPHER_LIST_HEAD " ECDHE-RSA-AES128-SHA256:" \
69+ " AES128-GCM-SHA256:HIGH:!RC4:!MD5:!aNULL:!EDH"
70+
6571namespace node {
6672
6773const char * root_certs[] = {
@@ -4197,16 +4203,30 @@ const char* ToCString(const node::Utf8Value& value) {
41974203 return *value ? *value : " <string conversion failed>" ;
41984204}
41994205
4200- Handle<Value> DefaultCiphers (const Arguments& args) {
4206+ const char * LegacyCipherList (const char * ver) {
4207+ if (ver == NULL ) {
4208+ return NULL ;
4209+ }
4210+ if (strncmp (ver, " v0.10.38" , 8 ) == 0 ) {
4211+ return DEFAULT_CIPHER_LIST_V10_38;
4212+ } else {
4213+ return NULL ;
4214+ }
4215+ }
4216+
4217+ Handle<Value> GetLegacyCiphers (const Arguments& args) {
42014218 HandleScope scope;
4219+
42024220 unsigned int len = args.Length ();
42034221 if (len != 1 || !args[0 ]->IsString ()) {
42044222 return ThrowException (
42054223 Exception::TypeError (
42064224 String::New (" A single string parameter is required" )));
42074225 }
4226+
42084227 node::Utf8Value key (args[0 ]);
4209- const char * list = legacy_cipher_list (ToCString (key));
4228+ const char * list = LegacyCipherList (ToCString (key));
4229+
42104230 if (list != NULL ) {
42114231 return scope.Close (v8::String::New (list));
42124232 } else {
@@ -4294,7 +4314,7 @@ void InitCrypto(Handle<Object> target) {
42944314 v8::String::New (DEFAULT_CIPHER_LIST),
42954315 static_cast <v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
42964316
4297- NODE_SET_METHOD (target, " getLegacyCiphers" , DefaultCiphers );
4317+ NODE_SET_METHOD (target, " getLegacyCiphers" , GetLegacyCiphers );
42984318}
42994319
43004320} // namespace crypto
0 commit comments