我在Windows上使用git.我安装了msysgit包.我的测试存储库在服务器上有一个自签名证书.我可以使用http访问和使用存储库而不会出现问题.移至https会出现错误"SSL证书问题:无法获取本地颁发者证书".
我在Windows 7客户端计算机的受信任的根证书颁发机构中安装了自签名证书.我可以浏览到Internet Explorer中的https存储库URL,没有错误消息.
本博客http://blogs.msdn.com/b/phkelley/archive/2014/01/20/adding-a-corporate-or-self-signed-certificate-authority-to-git-exe-s-store. aspx解释说curl不使用客户机的证书存储区.我按照博客文章的建议创建了curl-ca-bundle.crt的私有副本,并配置git来使用它.我确信git正在使用我的副本.如果我重命名副本; git抱怨文件丢失了.
我粘贴在我的证书中,如博客文章中所述,我仍然收到"无法获得本地颁发者证书"的消息.
我通过https克隆了一个GitHub存储库,验证了git仍在工作.
我唯一看到的与博客文章不同的是我的证书是根证书 - 没有链条可以达到它.我的证书最初来自于单击IIS8 IIS管理器链接"创建自签名证书".也许这使得证书在某种程度上与curl期望的不同.
如何获得git/curl接受自签名证书?
root@sclrdev:/home/sclr/certs/FreshCerts# curl --ftp-ssl --verbose ftp://{abc}/ -u trup:trup --cacert /etc/ssl/certs/ca-certificates.crt
* About to connect() to {abc} port 21 (#0)
* Trying {abc}...
* Connected to {abc} ({abc}) port 21 (#0)
< 220-Cerberus FTP Server - Home Edition
< 220-This is the UNLICENSED Home Edition and may be used for home, personal use only
< 220-Welcome to Cerberus FTP Server
< 220 Created by Cerberus, LLC
> AUTH SSL
< 234 Authentication method accepted
* successfully set certificate verify locations:
* CAfile: …Run Code Online (Sandbox Code Playgroud) 我使用curl来验证PayPal IPN,但它会抛出错误:SSL certificate problem: unable to get local issuer certificate.相同的代码正在开发服务器上,当我移动到客户端服务器时,它无法正常工作.
我是否需要购买ssl认证才能通过PayPal快速结账或我的编码部分的任何更改或任何需要在服务器上进行的设置付款.服务器上已启用了Cookie.任何帮助将不胜感激.
我的代码如下,以及针对此的简化测试页:
$req = HAVING PARAMETERS FROM PAYPAL;
$ch = curl_init("https://www.sandbox.paypal.com/cgi-bin/webscr");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
curl_exec($ch);
if(curl_errno($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
Run Code Online (Sandbox Code Playgroud)