Skip to content

Instantly share code, notes, and snippets.

@ggrandes
Last active August 29, 2015 14:08
Show Gist options
  • Save ggrandes/19e3b72d49cb1a563cb0 to your computer and use it in GitHub Desktop.
Save ggrandes/19e3b72d49cb1a563cb0 to your computer and use it in GitHub Desktop.
Show supported Java procotols an cipher suites for SSL / TLS
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import java.security.Provider;
import java.security.Security;
public class SSLSupport {
public static void main(String[] args) throws Throwable {
try {
final String bcName = "org.bouncycastle.jce.provider.BouncyCastleProvider";
Security.addProvider((Provider) Class.forName(bcName).newInstance());
} catch (Throwable t) {
System.out.println("Unable to register BouncyCastleProvider: " + t.toString());
}
SSLContext ctx = SSLContext.getDefault();
SSLParameters sslParams = ctx.getSupportedSSLParameters();
System.out.println("### Protocols ###");
for (String proto : sslParams.getProtocols()) {
System.out.println(proto);
}
System.out.println("### CipherSuites ###");
for (String suite : sslParams.getCipherSuites()) {
System.out.println(suite);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment