Curl_exec Error 58 Unable
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the php exec curl company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions php exec curl post Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million curl multi exec programmers, just like you, helping each other. Join them; it only takes a minute: Sign up cURL with SSL certificates fails: error 58 unable to set private key file up vote 4 down vote favorite I'm unable to set private key file push notification trying to connect to a remote host using cURL. The connection requires the use of a certificate and a private key which is password protected. So far I'm unsuccessful with this code below:
Unable To Set Private Key File Php
false); $output = curl_exec($ch); var_dump(curl_errno($ch)); var_dump(curl_error($ch)); The result I keep getting is error 58: unable to set private key file: '/home/.../domains/.../public_html/auth/key.pem' type PEM. Things I've tried so far: Check if the key-file is readable as suggested here: Unable to use libcurl to access a site requiring client authentication. Trying to pass the file through openssl_private_key() gives me a resource, and not a boolean. So this seems good. Switch the order of the content in the key.pem file as suggested here: Unable to use libcurl to access a site requiring client authentication. No luck so far. Played around with some other options like SLL_VERIFY_PEER, SSL_VERIFY_HOST, SSL_CERTTYPE and other options which seemed trivial regarding the official PHP-docs. No luck so far. I'm pretty sure the problem lies somehwere in my configuration, but I'm not sure where to look. php ssl curl certificate share|improve this question asked Nov 24 '14 at 10:04 Ben 4,56873474 "Switch the order of the content in the key.pem". You key.pem file (which contains the private key) should only really contain 1 PEM-encoded section (for the private key). It's the order of the cert file you might need to change. The client-cert for this private key should be at the top. –Bruno Nov 24 '14 at 10:51 add a comment| 2 Answers 2 active oldest
[ Next message ] [ Previous message ] [ Maybe in reply to ] [ Next in
Unable To Set Private Key File Pem
thread ] [ Replies ] From: The PayPerPhone company; Willem Blok curl unable to load client cert -8018
[ Next message ] [ Next in thread ] [ Replies ] From: Dan Brown
Gherkin Git Go Groovy Haml Handlebars Haskell HTML HTTP Ini iOS Jade Java Javascript jQuery JSON Julia Keyman LaTeX Linux Less LOLCODE Makefile Markdown MATLAB MySQL NASM Node.js NSIS Objective-C Pascal Perl PHP PHP Extras PowerShell Python R React JSX reST (reStructuredText) Rip Ruby Rust SAS Sass (Sass) Sass (Scss) Scala Scheme Smalltalk Smarty SQL Stylus Swift Twig TypeScript Vb.net VHDL Wiki markup YAML Other Search Ben - 3 months ago 76x PHP Question cURL with SSL certificates fails: error 58 unable to set private key file I'm trying to connect to a remote host using cURL. The connection requires the use of a certificate and a private key which is password protected. So far I'm unsuccessful with this code below: $wsdl = 'https://domain.com/?wsdl';
$certFile = getcwd() . '/auth/cert.pem';
$keyFile = getcwd() . '/auth/key.pem';
$password = 'pwd';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $wsdl);
curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, $password);
curl_setopt($ch, CURLOPT_SSLKEY, $keyFile);
#curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
#curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
#curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$output = curl_exec($ch);
var_dump(curl_errno($ch));
var_dump(curl_error($ch));
The result I keep getting is error 58: unable to set private key file: '/home/.../domains/.../public_html/auth/key.pem' type PEM. Things I've tried so far: Check if the key-file is readable as suggested here: Unable to use libcurl to access a site requiring client authentication. Trying to pass the file through openssl_private_key() gives me a resource, and not a boolean. So this seems good. Switch the order of the content in the key.pem file as suggested here: Unable to use libcurl to access a site requiring client authentication. No luck so far. Played around with some ot