cURL SSL证书在Linux上运行但在Windows上运行

时间:2016-06-02 03:17:07

标签: linux ssl curl ssl-certificate

我正在使用cURL使用HTTPS协议对URL进行GET请求。我从Web服务的所有者检索了CA Cert文件。 .crt文件在RHEL5中工作,但在Windows中不能使用相同的命令。以下是我正在使用的命令:

RHEL5,未指定--cacert

bash-3.2$ curl -i "https://<url>" --cacert ca-bundle.crt 
HTTP/1.1 200 OK
Transfer-encoding: chunked
Cache-control: no-cache
Content-type: text/html
Pragma: no-cache
Date: Thu, 02 Jun 2016 03:06:32 GMT

<data>

RHEL5,指定--cacert

curl -i "https://<url>"
curl: (35) schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT
 (0x80090325) - The certificate chain was issued by an authority that is not trusted.

Windows未指定--cacert

curl -i "https://<url>" --cacert C:\<path>\ca-bundle.crt
curl: (35) schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT
 (0x80090325) - The certificate chain was issued by an authority that is not trusted.

Windows指定--cacert

public interface Animal {

    public void eat();
}


public class Dog implements Animal {

    @Override
    public void eat() {
        System.out.println("dog eating");   
    }

}


public class MainClass {

    public static void main(String[] args) {    
        Animal a = new Dog();
        a.eat();
    }
}

我使用完全相同的.crt文件。关于可能出现什么问题的任何建议?

0 个答案:

没有答案