Ruby Net::HTTP using SSL Version

1.2k Views Asked by At

When using ssl_version of TLSv1_2 and the receiver is using tls version 1.0, will it honor both tls version 1 and 1.2?

conn.use_ssl = useSSL
conn.ssl_version="TLSv1_2"
conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
1

There are 1 best solutions below

0
Holger Just On

By setting conn.ssl_version="TLSv1_2", you are forcing the TLS version to exactly TLS 1.2. thus, the connection will be negotiated either with this exact version, or not at all. If the server only offers TLS 1.0, TLS 1.1 or even (exclusively) TLS 1.3, then the connection will not be established.

Note that this is unrelated to the verify_mode which only affects how the certificates presented by the server are validated. With OpenSSL::SSL::VERIFY_NONE, you are telling the client that it should not check whether the certificates can be validated against any trusted root certificates. The server must still provide a syntactically valid certificate and "correct" encryption.