Is it possible to enable TLS v1.2 in Ruby? If so, how?

Is it possible to use TLSv.1.2 or TLSv1.1 with Ruby?

I have compiled a Frankenstein version of Ruby using OpenSSL 1.0.1c (the latest available) and the only difference being is SSLv2 is now an option under OpenSSL::SSL::SSLContext::METHODS

Is it possible to add TLSv1.2 to that list?


Yes, we added TLS 1.1 & 1.2 support recently. It's as easy as setting ssl_version on your SSLContext:

ctx =
ctx.ssl_version = :TLSv1_2

You may still continue to use the more generic :SSLv23 for maximum interoperability. It will have the effect that the newest protocol supported by the peer will be used for the connection. If your peer understands TLS 1.2, then it will be used. But opposed to the above sample, if the peer does not speak 1.2, then the implementation will silently fall back to the best/newest version that the peer does understand - while in the above example, the connection would be rejected by the peer if it did not recognize 1.2.

For further details, also have a look at OpenSSL's own docs on the subject, you can transfer what's being said about TLSv1_method to TLSv1_1_method and TLSv1_2_method (represented in Ruby as :TLSv1, :TLSv1_1 and :TLSv1_2 respectively).

If your underlying OpenSSL supports TLS 1.2 (>= 1.0.1 does), you're good to go. However, this requires a Ruby build from trunk currently. But if we get no negative feedback in the meantime, it might well be that it will be backported to the next 1.9.3 release.

Need Your Help

Android manifest attribute not allowed here

android xml android-studio manifest

I have several manifest errors regarding some attributes . I have not made any changes to the manifest the application generated automatically yet i get several errors. *( I'm using Android Studio ...

Android Studio/Intellij Idea: "Table of Contents" for a class

android-studio intellij-idea

I have been messing around with Android Studio and so far I like most of what I have seen. One thing that has been annoying me though is this lack of "Table of Contents" for a class. I apologize fo...