【问题标题】:PHP CURL - cURL error 35: error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature typePHP CURL - cURL 错误 35:错误:1414D172:SSL 例程:tls12_check_peer_sigalg:错误的签名类型
【发布时间】:2020-02-09 01:36:13
【问题描述】:

我想在 PHP 7.3.90 中发出 curl 请求

curl -V
curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 

    $ch = curl_init();
    // 2. set the options, including the url
    curl_setopt($ch, CURLOPT_URL, "https://mydomain/get-token");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("App-Key: YOUR-KEY-HERE"));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);

答案是

"cURL error 35: error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"

我在使用 curl 命令时遇到了同样的问题,我用它解决了它

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=1

而不是

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2

https://github.com/curl/curl/issues/4097OpenSSL v1.1.1 ssl_choose_client_version unsupported protocol

我必须使用哪个 curl 选项来解决此错误?

谢谢

【问题讨论】:

标签: php curl openssl


【解决方案1】:

我刚刚在 Debian 上从 OpenSSL 1.1.0 升级到 1.1.1 后遇到了这个问题。

我在这里找到了解决方案https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900984

/etc/ssl/openssl.cnf 中将SECLEVEL 2 替换为SECLEVEL 1,因为SECLEVEL 2 可以防止SHA1 加密,这在我的例子中是Moneris 所必需的,它似乎只支持已弃用的SHA1 签名。

【讨论】:

    【解决方案2】:

    我知道这个问题已经很老了,但我在使用一些旧的 coughhermescaugh api 时遇到了同样的问题。

    我也不想将整个系统的 seclevel 设置为 1。 您正在寻找的是以下内容:

     curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'DEFAULT@SECLEVEL=1');
    

    只需将这段代码放入您的应用程序中,您就可以满足这个请求了。 当然这不是最安全的方法,但是当 Api 设置不正确时,您别无选择。

    【讨论】:

      【解决方案3】:

      Ubuntu 20 上升级后,我遇到了同样的问题。

      解决方案是升级到 openssl-1.1.1g 。默认情况下,Ubuntu 20 使用效果不佳的 openssl-1.1.1f

      link to an installation solution 表示尚未打包的 openssl 版本。

      【讨论】:

        【解决方案4】:

        简单地将DEFAULT@SECLEVEL 设置为1 不起作用,因为我需要使用OpenSSL 1.1.1f 31 Mar 2020Ubuntu 20.04.3 LTS 上解决该问题。 我在https://askubuntu.com/a/1233456/306766 找到的解决方案对我有用。

        您需要将此添加到配置文件的开头 (/etc/ssl/openssl.cnf):

        openssl_conf = default_conf
        

        然后到最后:

        [ default_conf ]
        
        ssl_conf = ssl_sect
        
        [ssl_sect]
        
        system_default = system_default_sect
        
        [system_default_sect] MinProtocol = TLSv1.2 CipherString =
        DEFAULT:@SECLEVEL=1
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2015-06-30
          • 2016-08-15
          • 2019-02-13
          • 2018-06-16
          • 1970-01-01
          • 2014-03-20
          • 1970-01-01
          • 2013-02-03
          相关资源
          最近更新 更多