php curl https ssl 認證問題

來源:互聯網
上載者:User
CURL代碼:
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_PORT, 443);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //信任任何認證
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 檢查認證中是否設定網域名稱,0不驗證
curl_setopt($curl, CURLOPT_VERBOSE, 1); //debug模式
curl_setopt($curl, CURLOPT_SSLCERT, "./keys/client.crt"); //client.crt檔案路徑
curl_setopt($curl, CURLOPT_SSLCERTPASSWD, "112358"); //client認證密碼
curl_setopt($curl, CURLOPT_SSLKEY, "./keys/client.key");

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

一直返回 int 58 這個CURL錯誤
int 58
unable to use client certificate (no key found or wrong pass phrase?)

把認證重建了一次,還是不行
本地環境 WAMP 產生的認證直接在IE瀏覽器上安全是可以訪問的
有沒有同學遇到過呢?


回複討論(解決方案)

自己解決了,之前是認證產生的不對,現在是路徑寫的不對……

這段代碼先保留了。以後參考。

想問下,client.crt和client.key是怎麼獲得的呢,對方只給了我p12檔案和一個crt檔案

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.