Xavier
Xavier

Reputation: 9049

Why do I get an error with my code in erlang 21 but not in erlang 20?

When I do the following in Erlang 21 I get an error.

inets:start(),
ssl:start(),
httpc:request(post,
             {"https://sandbox.itunes.apple.com/verifyReceipt", [], "application/json", []},
             [], []).

The error is:

=INFO REPORT==== 3-Oct-2018::19:32:47.728491 ===
TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure

{error,{failed_connect,[{to_address,{"sandbox.itunes.apple.com",443}},
                        {inet,[inet],{tls_alert,"handshake failure"}}]}}

When I do the the same in Erlang 20, it works just fine.

Can someone clue me in on what might be wrong?

Upvotes: 5

Views: 1016

Answers (1)

Eugen Dubrovin
Eugen Dubrovin

Reputation: 906

Made some research and found that due to OTP 21 Highlights

Security: "unsecure" ciphers removed from defaults in SSL and SSH.

You need to configure SSL manualy (enable ciphers)

EnabledCiphers = ssl:cipher_suites(all, 'tlsv1.2'),
Options = [{ciphers, EnabledCiphers}],

httpc:request(post,{"https://sandbox.itunes.apple.com/verifyReceipt",
[],"application/json", []}, [{ssl,Options}], []).

Upvotes: 9

Related Questions