是否可以在 Ruby 中启用 TLS v1.2?如果是这样,如何? [英] Is it possible to enable TLS v1.2 in Ruby? If so, how?

查看:21
本文介绍了是否可以在 Ruby 中启用 TLS v1.2?如果是这样,如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Ruby 中使用 TLSv.1.2 或 TLSv1.1?

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

我已经使用 OpenSSL 1.0.1c(最新版本)编译了一个 Frankenstein 版本的 Ruby,唯一的区别是 SSLv2 现在是 OpenSSL::SSL::SSLContext::METHODS 下的一个选项

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

是否可以将 TLSv1.2 添加到该列表中?

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

推荐答案

是的,我们添加了 TLS 1.1 &1.2 支持最近.就像在 SSLContext 上设置 ssl_version 一样简单:

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

ctx = OpenSSL::SSL::SSLContext.new
ctx.ssl_version = :TLSv1_2

您仍可以继续使用更通用的 :SSLv23 以获得最大的互操作性.这将产生对等方支持的最新协议将用于连接的效果.如果您的对等方了解 TLS 1.2,则将使用它.但是与上面的示例相反,如果对等方不说 1.2,那么实现将默默地回退到对等方确实理解的最佳/最新版本 - 而在上面的示例中,连接将1.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.

有关更多详细信息,还可以查看 OpenSSL 自己的文档 在这个主题上,您可以将关于 TLSv1_method 的内容转移到 TLSv1_1_method 和 TLSv1_2_method(在 Ruby 中表示为 :TLSv1:TLSv1_1:TLSv1_2:TLSv1_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).

如果您的底层 OpenSSL 支持 TLS 1.2(>= 1.0.1 支持),那么您就可以开始了.但是,目前这需要从主干构建 Ruby.但如果我们在此期间没有收到负面反馈,很可能会向后移植到下一个 1.9.3 版本.

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.

这篇关于是否可以在 Ruby 中启用 TLS v1.2?如果是这样,如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆