Как проверить SSL-сертификат login.live.com с помощью cURL, PHP и Windows XAMPP

Мне нужно сделать HTTP-запрос https://login.live.com/oauth20_token.srf с cURL в PHP. cURL всегда выдает следующее сообщение об ошибке: SSL certificate problem: unable to get local issuer certificate (ошибка 60). Это моя настройка :

  • Друзья Apache XAMPP v5.6.3 для Windows 7 64-разрядные (без изменений конфигурации); Это включает:
  • PHP 5.6.3
  • cURL 7.39.0
  • OpenSSL / 1.0.1i

Я включил файл ca-bundle.crt с веб-сайта cURL CA Extract с параметром CURLOPT_CAINFO . Этот файл включает в себя VeriSign Class 3 Public Primary Certification Authority - G5 сертификат VeriSign Class 3 Public Primary Certification Authority - G5 . Этот сертификат идентичен корневому сертификату, отображаемому Firefox для https://login.live.com/oauth20_token.srf .

Это мой тестовый скрипт PHP :

 <?php // $url = 'https://api.onedrive.com'; $url = 'https://login.live.com/oauth20_token.srf'; $ch = curl_init($url); $errorLog = fopen('php://temp', 'rw'); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_STDERR, $errorLog); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . DIRECTORY_SEPARATOR . 'ca-bundle.crt'); curl_exec($ch); $error = curl_error($ch); if ($error != '') { echo "### cURL error: ###\n"; echo curl_errno($ch) . ' ' . curl_error($ch) . "\n\n"; } curl_close($ch); echo "### cURL verbose output: ###\n"; rewind($errorLog); echo stream_get_contents($errorLog); 

Он генерирует следующий результат :

 ### cURL error: ### 60 SSL certificate problem: unable to get local issuer certificate ### cURL verbose output: ### * Hostname was found in DNS cache * Trying 131.253.61.98... * Connected to login.live.com (131.253.61.98) port 443 (#0) * successfully set certificate verify locations: * CAfile: C:\xampp\htdocs\curl\ca-bundle.crt CApath: none * SSL certificate problem: unable to get local issuer certificate * Closing connection 0 

Я проверил другой URL-адрес , https://api.onedrive.com . Согласно Firefox, этот корневой сертификат этого сайта является сертификатом Baltimore CyberTrust Root , который также включен в файл ca-bundle.crt . Для этого URL cURL работает так, как ожидалось, и сценарий генерирует следующий результат :

 ### cURL verbose output: ### * Rebuilt URL to: https://api.onedrive.com/ * Hostname was found in DNS cache * Trying 134.170.106.24... * Connected to api.onedrive.com (134.170.106.24) port 443 (#0) * successfully set certificate verify locations: * CAfile: C:\xampp\htdocs\curl\ca-bundle.crt CApath: none * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA384 * Server certificate: * subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; OU=Microsoft Corporation; CN=storage.live.com * start date: 2015-03-03 21:28:09 GMT * expire date: 2017-03-02 21:28:09 GMT * subjectAltName: api.onedrive.com matched * issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT SSL SHA2 * SSL certificate verify ok. > GET / HTTP/1.1 Host: api.onedrive.com Accept: */* < HTTP/1.1 400 Bad Request < Content-Length: 264 < Content-Type: application/json < Server: Microsoft-HTTPAPI/2.0 < P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo" < X-MSNSERVER: BN1305____PAP241 < X-QosStats: {"ApiId":0,"ResultType":2,"SourcePropertyId":0,"TargetPropertyId":42} < X-ThrowSite: 7ecf.1484 < X-AsmVersion: UNKNOWN; 19.15.0.0 < Date: Tue, 17 Mar 2015 17:34:56 GMT < * Connection #0 to host api.onedrive.com left intact 

Я также экспортировал VeriSign Class 3 Public Primary Certification Authority - G5 сертификат VeriSign Class 3 Public Primary Certification Authority - G5 с https://login.live.com/oauth20_token.srf с Firefox и использовал этот сертификат вместо файла ca-bundle.crt . Я также добавил промежуточный сертификат VeriSign Class 3 Extended Validation SSL SGC CA Оба не помогли.

Как я могу проверить SSL-сертификат login.live.com с данной настройкой? Установка CURLOPT_SSL_VERIFYPEER на false – это не то, что я ищу.

ОБНОВЛЕНИЕ: Я провел еще несколько исследований, и теперь похоже, что это может быть проблема OpenSSL в Windows .