gpt4 book ai didi

php - 关闭 cURL 中的 CURLOPT_SSL_VERIFYPEER 是否会使传输不安全?

转载 作者:太空宇宙 更新时间:2023-11-03 12:56:56 24 4
gpt4 key购买 nike

关于 PHP docs page关于 curl_setopt 最赞的评论是

Please everyone, stop setting CURLOPT_SSL_VERIFYPEER to false or 0. If your PHP installation doesn't have an up-to-date CA root certificate bundle, download the one at the curl website and save it on your server:

http://curl.haxx.se/docs/caextract.html

Then set a path to it in your php.ini file, e.g. on Windows:

curl.cainfo=c:\php\cacert.pem

Turning off CURLOPT_SSL_VERIFYPEER allows man in the middle (MITM) attacks, which you don't want!

真的吗?据我了解,关闭 CURLOPT_SSL_VERIFYPEER 会阻止 curl 验证对等方的证书,但数据传输保持安全。哪个是真的?

最佳答案

是的,这是不安全的。如果您不检查证书,则无法确定发件人确实是您认为正在与之交谈的服务器,并且它可能是冒名顶替者。中间的一个人。

即使冒名顶替者也可以运行 SSL 并与您协商加密连接。但他们可以(假设)使用合法证书名称为伪造站点购买证书。

关于php - 关闭 cURL 中的 CURLOPT_SSL_VERIFYPEER 是否会使传输不安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21195530/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com