`

查询JDK默认支持的SSL/TSL版本

阅读更多
  1. public static void main(String[] args) throws Exception {  
  2.         SSLContext context = SSLContext.getInstance("TLS");  
  3.         context.init(nullnullnull);  
  4.   
  5.         SSLSocketFactory factory = (SSLSocketFactory) context.getSocketFactory();  
  6.         SSLSocket socket = (SSLSocket) factory.createSocket();  
  7.   
  8.         String[] protocols = socket.getSupportedProtocols();  
  9.   
  10.         System.out.println("Supported Protocols: " + protocols.length);  
  11.         for (int i = 0; i < protocols.length; i++) {  
  12.             System.out.println(" " + protocols[i]);  
  13.         }  
  14.   
  15.         protocols = socket.getEnabledProtocols();  
  16.   
  17.         System.out.println("Enabled Protocols: " + protocols.length);  
  18.         for (int i = 0; i < protocols.length; i++) {  
  19.             System.out.println(" " + protocols[i]);  
  20.         }  
  21.   
  22.     }  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics