Question
如何修复(不是解决方法)Octave(假设 libcurl 与 Octave 捆绑) urlread 导致无法使用给定的 CA 证书对对等证书进行身份验证?
读过pkg 在 Windows 中从 forge 安装 http://octave.1599824.n4.nabble.com/pkg-install-from-forge-in-windows-td4680633.html,看起来 Octave 维护者已经意识到 Octave 4.0 的问题,但似乎没有可用的修复程序。
Issue
看起来 Windows 上的 Octave 的 urlread 不适用于 HTTPS,因为例如服务器证书https://octave.sourceforge.io https://octave.sourceforge.io无法使用 urlread (似乎调用curl)引用的受信任证书进行身份验证。
例如,share\octave\4.2.0\m\pkg\private\get_forge_pkg.m 第 64 行在尝试运行时会导致问题pkg 安装-forge安装软件包。
## Try get the list of all packages.
[html, succ] = urlread ("http://packages.octave.org/list_packages.php");
if (! succ)
error ("get_forge_pkg: could not read URL, please verify internet connection");
endif
从命令窗口运行 urlread 显示以下错误。
>> [html, status, msg] = urlread ("http://packages.octave.org/list_packages.php");
>> msg
msg = Peer certificate cannot be authenticated with given CA certificates
尝试通过 HTTPS 访问 google.com,结果相同。
>> [html, status, msg] = urlread ("https://google.com");
>> msg
msg = Peer certificate cannot be authenticated with given CA certificates
IE和Google Chrome根证书可以验证sourceforge证书。
尝试了如下系统。
#[html, succ] = urlread ("http://packages.octave.org/list_packages.php");
sURLLink="https://octave.sourceforge.io/list_packages.php"
command=['curl --insecure ','"',sURLLink,'"'];
[succ, html] = system(command)
#if (! succ)
if (succ != 0)
error ("get_forge_pkg: could not read URL, please verify internet connection");
endif
然而,它导致了另一个错误。
>> pkg install -forge symbolic
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 559 100 559 0 0 389 0 0:00:01 0:00:01 --:--:-- 393
sURLLink = https://octave.sourceforge.io/list_packages.php
succ = 0
html = bim
bsltl
cgi
....
error: get_forge_pkg: package NAME exists, but index page not available
error: called from
get_forge_pkg at line 74 column 7
get_forge_download at line 26 column 12
pkg at line 382 column 29
相关信息
- pkg 在 Windows 中从 forge 安装 http://octave.1599824.n4.nabble.com/pkg-install-from-forge-in-windows-td4680633.html
- urlread()、urlwrite() 不适用于 Octave for Windows 中的 https 页面 https://stackoverflow.com/questions/26237960/urlread-urlwrite-dont-work-for-https-pages-in-octave-for-windows
- windows libcurl - 无法使用给定的 ca 证书对对等证书进行身份验证 https://stackoverflow.com/questions/40752114/windows-libcurl-peer-certificate-cannot-be-authenticated-with-given-ca-certifi
- Curl 中出现错误 - 无法使用已知的 CA 证书对对等证书进行身份验证 https://stackoverflow.com/questions/14682894/getting-error-in-curl-peer-certificate-cannot-be-authenticated-with-known-ca-c
- SSL CA 证书 - LibCurl C 语言 (Linux) https://stackoverflow.com/questions/26719772/ssl-ca-certificates-libcurl-c-language-linux
环境
- Windows 7 Enterprise 64 位版本 6.1.7601 Service Pack 1 Build 7601 上的 Octave-4.2.0-w64
- Windows 10 Pro 64 位版本 10.0.14393 内部版本 14393 上的 Octave 4.0.3