<div dir="ltr">Hi there,<div><br></div><div>I am attempting to use the ssl module in order to get a socket to a remote server (MongoDB). I am using the following line of code (OTP 19)</div><div><br></div><div>ssl:connect("<a href="http://my-server.net">my-server.net</a>", 27017, [binary, {active, false}, {packet, raw}], 5000).</div><div><br></div><div>Whenever I use this, I get the following:</div><div><br></div><div><div>=ERROR REPORT==== 20-Dec-2016::19:13:13 ===</div><div>SSL: certify: tls_connection.erl:603:Fatal error: handshake failure - malformed_handshake</div><div>{error,{tls_alert,"handshake failure"}}</div></div><div><br></div><div>Which lead me to look into erlang:get_stacktrace/0</div><div><br></div><div><div>erlang:get_stacktrace().<br>[{tls_connection,start_fsm,8,</div><div>                 [{file,"tls_connection.erl"},{line,79}]},</div><div> {ssl_connection,connect,8,</div><div>                 [{file,"ssl_connection.erl"},{line,84}]},</div><div> {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]},</div><div> {shell,exprs,7,[{file,"shell.erl"},{line,686}]},</div><div> {shell,eval_exprs,7,[{file,"shell.erl"},{line,641}]},</div><div> {shell,eval_loop,3,[{file,"shell.erl"},{line,626}]}]</div></div><div><br></div><div>My problem is that the certificate that the server is using should be legitimate. I can connect, without error, using other clients and languages.</div><div><br></div><div>I took a look through Wireshark in order to try and figure out what is going on and this is what I see.</div><div><br></div><div>* The Client says hello and presents a list of cipher suites.</div><div>* The Server says hello and says that it wants to use TLS_RSA_WITH_AES_256_GCM_SHA384 (This cipher is in the list that the client sends)</div><div>* The Server sends the Client the certificates it is using (these both appear to be signed by DigiCert).</div><div>* The Server sends an encrypted handshake message.</div><div>* The Client responds with a Fatal Alert stating a Handshake Failure.</div><div>* The Server sends another encrypted handshake message.</div><div><br></div><div>I have verified that ssl:connect/4 is working fine as I can connect to a number of different miscellaneous services (including a number of other MongoDB instances).</div><div><br></div><div>I was wondering if there is anything else I can do to try and figure out why erlang does not allow this connection.</div><div><br></div><div>Justin </div></div>