【问题标题】:Has anyone tried using TLS 1.3 using SChannel with Windows-11 21h2?有没有人尝试使用带有 Windows-11 21h2 的 SChannel 使用 TLS 1.3?
【发布时间】:2022-02-03 10:48:00
【问题描述】:

我正在开发一个需要升级才能在 Windows-11 上使用 TLS 1.3 的 TLS 客户端。有没有人使用 SChannel API 成功实现 TLS 1.3?

根据 Microsoft 以下链接,win-11 和 server-2022 支持 TLS 1.3

https://docs.microsoft.com/en-us/windows/win32/secauthn/protocols-in-tls-ssl--schannel-ssp-

为 TLS1.3 添加了以下代码片段:

#define SECURITY_PROTOCOL_TLSV13 0x00
securityInfo->bySecurityProtocol = SECURITY_PROTOCOL_TLSV13;
sChannelCred->grbitEnabledProtocols =SP_PROT_TLS1_3_CLIENT;

status = pMyFunTab->**AcquireCredentialsHandleA**(NULL, UNISP_NAME_A, SECPKG_CRED_OUTBOUND, NULL, &sChannelCred, NULL, NULL, phCred, &ts);

返回状态 = SEC_E_ALGORITHM_MISMATCH(0x80090331)

**error details: Secure connection failed. An error occurred while trying to connect to the host, error code 0x80090331. The client and server cannot communicate, because they do not possess a common algorithm.**

api 链接:

https://docs.microsoft.com/en-us/windows/win32/api/sspi/nf-sspi-acquirecredentialshandlea https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/SecAuthN/acquirecredentialshandle--schannel.md


尝试了以下更改以修复相同的问题:

Windows 版本测试: windows 11 21h2 操作系统构建 22000.434

注册表更改:如下所示链接: how to enable TLS 1.3 in windows 10

非常感谢任何建议或一小部分 C++ 代码示例, 以及任何可以帮助我了解客户问题所在的建议。

仅供参考:我没有使用 CURL LIB。

谢谢

问候:阿杰·贾斯瓦尔

【问题讨论】:

  • 请尝试将问题集中在一个特定问题上。询问其他人是否使用过它以及询问示例代码是题外话。如果你展示你的代码,帮助会更容易
  • 你控制连接的两端吗?完全有意义的是接收端不支持正确的版本,所以你得到的错误就是它所说的

标签: c++ tls1.3 windows-11 schannel


【解决方案1】:

有一个支持 schannel tls 1.3 的 curl 拉取请求

你可以看看https://github.com/curl/curl/pull/7784

【讨论】:

  • 感谢您的建议,我错过了补充说我没有使用 CURL Lib。如果您可以在没有 CURL 的情况下提供帮助,那就太好了!谢谢
【解决方案2】:

Gilles,您是否在 Win10 或 Win11 上使用 schannel 作为 SSL 后端尝试了最新的 curl 7.81.0?以下是我看到的。

curl -vI --tls-max 1.3 https://www.google.com
*   Trying 142.251.35.164:443...
* Connected to www.google.com (142.251.35.164) port 443 (#0)
* schannel: disabled automatic use of client certificate
* schannel: TLS 1.3 is not yet supported
* Closing connection 0
curl: (35) schannel: TLS 1.3 is not yet supported

【讨论】:

    【解决方案3】:

    我在 Win11 中遇到了同样的问题,但下面的相同代码在 Win10 中有效。请注意,我的 Win11 的注册表中已启用 TLS 1.3。

         SCHANNEL_CRED SchannelCred;
         CredHandle hClientCreds;
         TimeStamp tsExpiry;
        
         PSecurityFunctionTable sspi = InitSecurityInterface();
        
         ZeroMemory(&SchannelCred, sizeof(SchannelCred));
         SchannelCred.dwVersion = SCHANNEL_CRED_VERSION;
         SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_3_CLIENT;
         SchannelCred.dwFlags |= SCH_CRED_MANUAL_CRED_VALIDATION | SCH_CRED_NO_DEFAULT_CREDS | SCH_USE_STRONG_CRYPTO;
        
         SECURITY_STATUS Status = sspi->AcquireCredentialsHandle(NULL,
             (SEC_CHAR*)UNISP_NAME_A,
             SECPKG_CRED_OUTBOUND,
             NULL,
             &SchannelCred,
             NULL,
             NULL,
             &hClientCreds,
             &tsExpiry);
    

    后来发现Win11中TLS 1.3需要使用SCH_CREDENTIALS结构而不是SCHANNEL_CRED结构。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-12
      • 1970-01-01
      • 2018-01-21
      • 2022-07-08
      • 2022-06-23
      • 2013-07-07
      • 2014-04-28
      • 2013-02-01
      相关资源
      最近更新 更多