Hi all,
I am trying to connect to an SSL Server with a certificate and a private key.
defmodule SSLTest do
@certfile ~c"/path/to/cert.cer"
@keyfile ~c"/path/to/key.pem"
def ssl_options do
[
certfile: @certfile,
keyfile: @keyfile,
verify: :verify_none
]
end
def connect() do
:ssl.connect(~c"api-test.host.com", 443, ssl_options())
end
end
This returning the following error:
{:error,
{:tls_alert,
{:handshake_failure,
~c"TLS client: In state cipher received SERVER ALERT: Fatal - Handshake Failure\n"}}}
If I run this with log_level: :debug
I can see the following:
09:44:26.103 [debug] [message: {:server_hello_done}, protocol: :handshake, direction: :inbound]
<<< Handshake, ServerHelloDone
[]
09:44:26.103 [debug] [message: {:certificate, []}, protocol: :handshake, direction: :outbound]
>>> Handshake, Certificate
[{asn1_certificates,[]}]
Does this mean that the client is not providing any certificates during the handshake?
If I set @certfile
to a path that does not exist I see the same handshake error, i.e. it seems that the file is not being accessed at all.
If I set @keyfile
to a path that does not exists, I get the error I would expect:
{:error,
{:options,
{:keyfile, ~c"/missing.pem", {:error, :enoent}}}}
Am I using the certfile
and keyfile
options wrong?
Best,
Nickolay.