Skip to content

Instantly share code, notes, and snippets.

@Talon876
Created January 23, 2017 19:53
Show Gist options
  • Save Talon876/ab3cd548984894e45e14c385f8c167ef to your computer and use it in GitHub Desktop.
Save Talon876/ab3cd548984894e45e14c385f8c167ef to your computer and use it in GitHub Desktop.
Prints out all supported ciphers
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.net.ssl.SSLServerSocketFactory;
//https://confluence.atlassian.com/stashkb/files/679609085/679772359/1/1414093373406/Ciphers.java
public class Ciphers
{
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