@@ -177,7 +177,7 @@ def test_set_ciphers_by_group_name
177
177
context = OpenSSL ::SSL ::SSLContext . new
178
178
context . ciphers = "AES"
179
179
180
- actual = context . ciphers . map { |cipher | cipher [ 0 ] }
180
+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
181
181
assert actual . include? ( "ECDHE-RSA-AES128-SHA" )
182
182
assert actual . include? ( "ECDHE-ECDSA-AES128-SHA" )
183
183
assert actual . include? ( "AES128-SHA" )
@@ -186,26 +186,43 @@ def test_set_ciphers_by_group_name
186
186
def test_set_ciphers_by_cipher_name
187
187
context = OpenSSL ::SSL ::SSLContext . new
188
188
context . ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384"
189
- actual = context . ciphers . map { |cipher | cipher [ 0 ] }
189
+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
190
190
assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" )
191
191
assert actual . include? ( "ECDHE-ECDSA-AES256-GCM-SHA384" )
192
192
end
193
193
194
194
def test_set_ciphers_by_array_of_names
195
195
context = OpenSSL ::SSL ::SSLContext . new
196
196
context . ciphers = [ "ECDHE-ECDSA-AES128-GCM-SHA256" , "ECDHE-ECDSA-AES256-GCM-SHA384" ]
197
- actual = context . ciphers . map { |cipher | cipher [ 0 ] }
197
+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
198
198
assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" )
199
199
assert actual . include? ( "ECDHE-ECDSA-AES256-GCM-SHA384" )
200
200
end
201
201
202
202
def test_set_ciphers_by_array_of_name_version_bits
203
203
context = OpenSSL ::SSL ::SSLContext . new
204
204
context . ciphers = [ [ "ECDHE-ECDSA-AES128-GCM-SHA256" , "TLSv1.2" , 128 , 128 ] ]
205
- actual = context . ciphers . map { |cipher | cipher [ 0 ] }
205
+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
206
206
assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" )
207
207
end
208
208
209
+ def test_set_ciphers_by_array_supports_setting_java_names
210
+ context = OpenSSL ::SSL ::SSLContext . new
211
+ context . ciphers = [
212
+ "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" , # Java name
213
+ "ECDHE-ECDSA-AES256-GCM-SHA384" , # Ruby name
214
+ 'TLS_AES_256_GCM_SHA384' # same name in Ruby/Java
215
+ ]
216
+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
217
+ assert actual . include? ( "ECDHE-ECDSA-AES128-GCM-SHA256" ) , actual . inspect
218
+ assert actual . include? ( "ECDHE-ECDSA-AES256-GCM-SHA384" ) , actual . inspect
219
+ assert actual . include? ( "TLS_AES_256_GCM_SHA384" ) , actual . inspect
220
+
221
+ context . ciphers = [ 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384' ]
222
+ actual = context . ciphers . map { |cipher | cipher [ 0 ] }
223
+ assert_equal actual , [ 'ECDHE-RSA-AES256-GCM-SHA384' ]
224
+ end
225
+
209
226
def test_set_ciphers_empty_array
210
227
context = OpenSSL ::SSL ::SSLContext . new
211
228
ex = assert_raise ( OpenSSL ::SSL ::SSLError ) do
0 commit comments