TLS client connection result is ok, but Error is expected:
case ssl:connect(Address,Port,TlsOpts,Timeout) of
{ok,Socket} ->
ssl:close(Socket),
{ok,Socket};
Error ->
Error
In the test we deliberately send wrong certificate to the server. Which replies with “CA unknown” alert, but that reply arrives later than close notify is sent from the client (ssl:close call).
While TLSv1.2 was used we got the Error with value “CA unknown”.
Now we are using TLSv1.3 and since Finished message is received in Server Hello we get the OK result and it seems that the alert “CA unknown” is not consumed.
I have tried to put some delay when the result is {ok, Socket} and check for ssl:connection_information(Socket):
case ssl:connect(Address,Port,TlsOpts,Timeout) of
{ok,Socket} ->
timer:sleep(1000),
case ssl:connection_information(Socket) of
{ok, Result} ->
ssl:close(Socket),
{ok,Socket};
Error ->
Error
end;
Error ->
Error
Then I get Error with value {error,closed} which probably indicates that TLS connection was closed because of the alert from server.
Is there a way to consume the “CA unknown” alert and get “CA unknown” value printed in Error?