В MacOS X если вы попытаетесь сделать запрос по протоколу https с использованием сертификата, то вероятно всего получите следующую ошибку

 Hostname was NOT found in DNS cache
 Trying xx.xx.xx.xx…
 Connected to example.com (xx.xx.xx.xx) port abcd (#0)
 WARNING: SSL: CURLOPT_SSLKEY is ignored by Secure Transport. The private key must be in the Keychain.
 WARNING: SSL: Certificate type not set, assuming PKCS#12 format.
 SSL: Can't load the certificate "/path/to/folder/cert.test.pem" and its private key: OSStatus -25299
 Closing connection 0 

Проблема описана тут http://curl.haxx.se/mail/archive-2013-10/0036.html.

Вкратце Apple заменила OpenSSL на собственный Secure Transport движок, которые работает с TLS версиями 1.1 и 1.2.

Теперь сертификаты учитываются только, если они находятся в репозитории Keychain, о чем говорится в ошибке.

Но выход есть: можно использовать старый добрый OpenSSL

brew install curl --with-openssl
brew link curl --force
hash -r
curl

Дополнительные ссылки:
http://www.farces.com/wikis/naked-server/php/php-openssl/ (для PHP)

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *