From 59b23b675fff9e7f2a3c7da83f4dc5f7295cf38a Mon Sep 17 00:00:00 2001 From: "Neil A. Wilson" Date: Fri, 6 Dec 2019 16:22:02 -0600 Subject: [PATCH] Allow selecting supported cipher suites Updated the TLS cipher suite selector to provide a static method to pare down a provided collection of TLS cipher suite names to include only those suites that are supported by the JVM. --- .../util/ssl/TLSCipherSuiteSelectorTestCase.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/unit/src/com/unboundid/util/ssl/TLSCipherSuiteSelectorTestCase.java b/tests/unit/src/com/unboundid/util/ssl/TLSCipherSuiteSelectorTestCase.java index 1a9beaf37..4a94f585f 100644 --- a/tests/unit/src/com/unboundid/util/ssl/TLSCipherSuiteSelectorTestCase.java +++ b/tests/unit/src/com/unboundid/util/ssl/TLSCipherSuiteSelectorTestCase.java @@ -27,6 +27,7 @@ import java.io.FileReader; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; @@ -262,21 +263,26 @@ public void testSelectSupportedCipherSuites() assertNotNull(selectedSuites); assertFalse(selectedSuites.isEmpty()); assertEquals(selectedSuites, - TLSCipherSuiteSelector.getSupportedCipherSuites()): + TLSCipherSuiteSelector.getSupportedCipherSuites()); selectedSuites = TLSCipherSuiteSelector.selectSupportedCipherSuites( TLSCipherSuiteSelector.getDefaultCipherSuites()); assertNotNull(selectedSuites); assertFalse(selectedSuites.isEmpty()); assertEquals(selectedSuites, - TLSCipherSuiteSelector.getDefaultCipherSuites()): + TLSCipherSuiteSelector.getDefaultCipherSuites()); selectedSuites = TLSCipherSuiteSelector.selectSupportedCipherSuites( TLSCipherSuiteSelector.getRecommendedCipherSuites()); assertNotNull(selectedSuites); assertFalse(selectedSuites.isEmpty()); assertEquals(selectedSuites, - TLSCipherSuiteSelector.getRecommendedCipherSuites()): + TLSCipherSuiteSelector.getRecommendedCipherSuites()); + + selectedSuites = TLSCipherSuiteSelector.selectSupportedCipherSuites( + Arrays.asList("unsupported1", "unsupported2", "unsupported3")); + assertNotNull(selectedSuites); + assertTrue(selectedSuites.isEmpty()); }