Skip to content

Commit

Permalink
Allow selecting supported cipher suites
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dirmgr committed Dec 6, 2019
1 parent e6d19bf commit 59b23b6
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}


Expand Down

0 comments on commit 59b23b6

Please sign in to comment.