我正在使用 Windows...
当我通过 gitbash 运行以下curl命令时,它工作正常:
curl --cacert ca.crt --key client.key --cert client.crt "https://myurl"
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试在命令提示符或 Powershell 中运行相同的命令,则会收到以下错误:
curl: (58) schannel: Failed to import cert file client.crt, last error is 0x80092002
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能让命令在命令提示符或 Powershell 中运行?
Mat*_*att 14
Windows 版本的curl.exe 未配置为与openssl 一起使用,但git 的可以。
\n因此,为了确保每当我在命令提示符中输入“curl”时,它都使用 git 版本的curl,我在系统环境变量中添加了 git 的curl (C:\\Program Files\\Git\\mingw64\\bin) 的路径并将其向右移动到顶部\xe2\x80\xa6,以便它在找到 window\xe2\x80\x99scurl 之前找到\xe2\x80\x99s git\xe2\x80\x99scurl。
\n然后重新启动命令提示符即可解决问题。
\n您提供的客户端证书格式错误。curl需要 PEM 格式的证书(来源):
Run Code Online (Sandbox Code Playgroud)-E/--cert <certificate[:password]> (SSL) Tells curl to use the specified certificate file when getting a file with HTTPS or FTPS. The certificate must be in PEM format. If the optional password isn't specified, it will be queried for on the terminal. Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated! See --cert and --key to specify them independently. If curl is built against the NSS SSL library then this option can tell curl the nickname of the certificate to use within the NSS database defined by the environment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be loaded. If you want to use a file from the current directory, please precede it with "./" prefix, in order to avoid confusion with a nickname. If this option is used several times, the last one will be used.
您的证书可能采用 DER 格式或包含整个证书链而不是单个客户端证书。
| 归档时间: |
|
| 查看次数: |
19905 次 |
| 最近记录: |