当前位置: 首页 > news >正文

Go 1.22 remote error: tls: handshake failure

Golang 1.22 remote error: tls: handshake failure

1.22之前运行下面代码是没有错误

package mainimport ("crypto/tls""fmt""net/http"
)func main() {http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}resp, err := http.Get("https://xxxxxxxxx")if err != nil {panic(err)}fmt.Println("status:", resp.Status)
}

但当golang升级1.22后就会出错,主要是crypto/tls 库已将基于 RSA 密钥交换的密码套件从默认列表中移除。这是因为基于 RSA 密钥交换的算法被认为是不够安全的,存在一些潜在的安全风险。

来源:https://pkg.go.dev/crypto/tls

// CipherSuites is a list of enabled TLS 1.0–1.2 cipher suites. The order of
// the list is ignored. Note that TLS 1.3 ciphersuites are not configurable.
//
// If CipherSuites is nil, a safe default list is used. The default cipher
// suites might change over time. In Go 1.22 RSA key exchange based cipher
// suites were removed from the default list, but can be re-added with the
// GODEBUG setting tlsrsakex=1.
CipherSuites []uint16

修复方法:设置ENV

os.Setenv("GODEBUG", "tlsrsakex=1")
http://www.lryc.cn/news/405881.html

相关文章:

  • 迈向通用人工智能:AGI的到来与社会变革展望
  • 大模型额外篇章三:vercel搭建openai中转服务器
  • 使用 jQuery 中的 this 实例
  • 下载最新版Anaconda、安装、更换源、配置虚拟环境并在vscode中使用
  • 极狐GitLab Git LFS(大文件存储)如何管理?
  • 迭代学习笔记
  • 【安全】系统安全设计规范(DOC完整版)
  • windows常用命令整理
  • 视频处理基础知识1
  • Linux退不出vim编辑模式
  • TikTok养号的网络环境及相关代理IP知识
  • 过程调用和数组的分配访问
  • TeamViewer手机端APP提示:请先验证账户
  • 【SpringBoot】分页查询
  • 微软CrowdStrike驱动蓝屏以及内核签名
  • Spring中Bean的循环依赖
  • Java二十三种设计模式-代理模式模式(8/23)
  • Windows 11 家庭中文版 安装 VMWare 报 安装程序检测到主机启用了Hyper-V或Device
  • 机械学习—零基础学习日志(高数09——函数图形)
  • java迭代集合出现并发修改异常(ConcurrentModificationException)的原因以及解决方案
  • BGP选路之Local Preference
  • WEB渗透信息收集篇--IP和端口信息
  • 国内微短剧系统平台抖音微信付费小程序app开发源代码交付
  • Java语言程序设计基础篇_编程练习题**15.19 (游戏:手眼协调)
  • 学习记录day16—— 数据结构 双向链表 循环链表
  • Air780EP模块 AT开发-MQTT接入OneNET移动物联网平台应用指南
  • HOST处理器预读PCI设备
  • 【Ansible】通过role角色部署lnmp架构
  • springboot给属性赋值的两种方式(yaml与properties)
  • 20240725 每日AI必读资讯