Created
October 15, 2017 15:43
-
-
Save stonehippo/0210c77185b59b0bf3d3662982e6e09b to your computer and use it in GitHub Desktop.
A Java class for getting info about the currently available SSL ciphers available (from http://markmail.org/message/zn4namfhypyxum23)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // invoke this with: java -showversion SSLInfo | |
| // Probably a good idea to compile this with -source & - target set to the Java version you're testing | |
| import java.util.Iterator; | |
| import java.util.Map; | |
| import java.util.TreeMap; | |
| import javax.net.ssl.SSLServerSocketFactory; | |
| public class SSLInfo | |
| { | |
| public static void main(String[] args) | |
| throws Exception | |
| { | |
| SSLServerSocketFactory ssf = | |
| (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); | |
| String[] defaultCiphers = ssf.getDefaultCipherSuites(); | |
| String[] availableCiphers = ssf.getSupportedCipherSuites(); | |
| TreeMap ciphers = new TreeMap(); | |
| for(int i=0; i<availableCiphers.length; ++i ) | |
| ciphers.put(availableCiphers[i], Boolean.FALSE); | |
| for(int i=0; i<defaultCiphers.length; ++i ) | |
| ciphers.put(defaultCiphers[i], Boolean.TRUE); | |
| System.out.println("Default\tCipher"); | |
| for(Iterator i = ciphers.entrySet().iterator(); i.hasNext(); ) { | |
| Map.Entry cipher=(Map.Entry)i.next(); | |
| if(Boolean.TRUE.equals(cipher.getValue())) | |
| System.out.print('*'); | |
| else | |
| System.out.print(' '); | |
| System.out.print('\t'); | |
| System.out.println(cipher.getKey()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment