找回密码
 加入
搜索
查看: 1616|回复: 3

[原创] Winhttp 支持所有https(TLS1.1/TLS1.2)

[复制链接]
发表于 2020-6-20 22:47:26 | 显示全部楼层 |阅读模式
本帖最后由 autoit3CN 于 2020-6-20 23:04 编辑

参考症状:
https://www.autoitscript.com/forum/topic/202818-lightstreamer-communication-with-autoit-moved/?tab=comments#comment-1456091
WinHttp 在 Win7 下访问特定网址的Bug

目标需求:
支持所有https协议返回正常数据

测试代码:
#include <WinHttp_GetRespond.au3>
#include <Array.au3>
$rContext = _WinHTTP_GetRespond(-1, "https://appleid.apple.com/account", 2);也许返回有点慢,耐心点,如果直接报错就符合本文症状
 _ArrayDisplay($rContext)

微软文档:

https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi

解决方法:

微软win7操作系统下 kb3140245补丁包
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp]
"DefaultSecureProtocols"=dword:00000a00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp]
"DefaultSecureProtocols"=dword:00000a00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings]
"SecureProtocols"=dword:00000a80

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"SecureProtocols"=dword:00000a80

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:0

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:0

拓展文章:

win7操作系统下kb3140245补丁包让wininet支持TSL

注意细节:
1.服务启动Windows Update 才可以正常安装更新包;
2.确认注册表有添加无对应项;
3.C:\Windows\System32\winhttp.dll 版本win7更新后是 6.1.7601.23375,请参照微软文档 File Information检查其他系统对应版本;
3.必须重启!重启!重启!


结语:
本人win7.服务器2012R2,花了几个小时查阅大量资料,存档与此方便后人吧。







评分

参与人数 2金钱 +149 贡献 +7 收起 理由
haijie1223 + 99 + 5 很给力!
afan + 50 + 2 赞一个!

查看全部评分

发表于 2020-6-20 22:58:04 | 显示全部楼层
我用XP,以前也是安装两个补丁解决。同样是伪装Protocols的套路~ 但有些可以,有些仍不支持。

评分

参与人数 1金钱 +30 收起 理由
autoit3CN + 30 淡定

查看全部评分

 楼主| 发表于 2020-6-20 23:08:59 | 显示全部楼层
TLS1.2 在 Win8.1 和 Win 10 默认支持,xp好多年没用了,自从用win7就没机会重装系统也就习惯了
发表于 2022-2-25 08:54:37 | 显示全部楼层
谢谢分享,楼主辛苦!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 03:26 , Processed in 0.077174 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表