C# 指定http請求使用Tls1.2

 

客戶端語言
版本
類庫
是否支持
兼容方案
 
Java 1.6.115之前   第三方支持包  
  1.6.115之後   啓動jvm 添加參數-Dhttps.protocols=TLSv1.1,TLSv1.2   
  1.7   啓動jvm 添加參數-Dhttps.protocols=TLSv1.1,TLSv1.2   
  1.8   默認支持  
Nodejs 各個版本   默認支持  
c#,asp.net 4.0-4.4  

在發送HTTP請求前加入下行代碼

ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
 
  4.5  

如果是4.5以上版本可以直接使用

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
 
Python  2.7-3   默認支持  
curl 7.19.7   默認支持  
Golang  1.7.4 net/http 默認支持  
Ruby          
php php5.6 file_get_contents    
    http\client    
    curl    
  php5.3.29 file_get_contents    
    http\client    
    curl    

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章