@@ -184,6 +184,39 @@ def test_context_ciphers
184184 assert_equal [ ] , diff
185185 end unless java7? # would need to filter out stuff such as ECDHE-RSA-AES128-GCM-SHA256
186186
187+ def test_set_ciphers_by_group_name
188+ context = OpenSSL ::SSL ::SSLContext . new
189+ context . ciphers = "AES"
190+
191+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
192+ assert actual . include? ( "ECDHE-RSA-AES128-SHA" )
193+ assert actual . include? ( "ECDHE-ECDSA-AES128-SHA" )
194+ assert actual . include? ( "AES128-SHA" )
195+ end
196+
197+ def test_set_ciphers_by_cipher_name
198+ context = OpenSSL ::SSL ::SSLContext . new
199+ context . ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384"
200+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
201+ assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" )
202+ assert actual . include? ( "ECDHE-ECDSA-AES256-GCM-SHA384" )
203+ end
204+
205+ def test_set_ciphers_by_array_of_names
206+ context = OpenSSL ::SSL ::SSLContext . new
207+ context . ciphers = [ "ECDHE-ECDSA-AES128-GCM-SHA256" , "ECDHE-ECDSA-AES256-GCM-SHA384" ]
208+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
209+ assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" )
210+ assert actual . include? ( "ECDHE-ECDSA-AES256-GCM-SHA384" )
211+ end
212+
213+ def test_set_ciphers_by_array_of_name_version_bits
214+ context = OpenSSL ::SSL ::SSLContext . new
215+ context . ciphers = [ [ "ECDHE-ECDSA-AES128-GCM-SHA256" , "TLSv1.2" , 128 , 128 ] ]
216+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
217+ assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" )
218+ end
219+
187220 def test_set_ciphers_empty_array
188221 context = OpenSSL ::SSL ::SSLContext . new
189222 ex = assert_raise ( OpenSSL ::SSL ::SSLError ) do
0 commit comments