diff options
author | emboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-06 22:26:08 +0000 |
---|---|---|
committer | emboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-06 22:26:08 +0000 |
commit | 060184c347822b11dff3db6bef915c04a564c4e4 (patch) | |
tree | 0b3261ceb587339e5884f3c332561d9132daea60 /test/openssl | |
parent | 6a7666e56290bd3647b4996c265b6794c3c9d0a4 (diff) | |
download | ruby-060184c347822b11dff3db6bef915c04a564c4e4.tar.gz |
* ext/openssl/ossl_ssl.c: support TLSv1.1 & TLSv1.1. Add
SSLContext#version to inspect the version that was negotiated for
a given connection.
* ext/openssl/extconf.rb: detect TLS 1.1 & 1.2 support.
* test/openssl/test_ssl.rb: add tests for TLS 1.1 & 1.2 given they
are supported by the native OpenSSL being used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl')
-rw-r--r-- | test/openssl/test_ssl.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 033d1e8be5..3ccb3cda87 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -437,6 +437,35 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ssl.close } end + + def test_tls_v_1_1 + ctx_proc = Proc.new { |ctx| + ctx.ssl_version = :TLSv1_1 + } + start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc) { |server, port| + sock = TCPSocket.new("127.0.0.1", port) + ssl = OpenSSL::SSL::SSLSocket.new(sock) + ssl.sync_close = true + ssl.connect + assert_equal("TLSv1.1", ssl.ssl_version) + ssl.close + } + end if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_1 + + def test_tls_v_1_2 + ctx_proc = Proc.new { |ctx| + ctx.ssl_version = :TLSv1_2 + } + start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc) { |server, port| + sock = TCPSocket.new("127.0.0.1", port) + ssl = OpenSSL::SSL::SSLSocket.new(sock) + ssl.sync_close = true + ssl.connect + assert_equal("TLSv1.2", ssl.ssl_version) + ssl.close + } + end if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2 + end end |