cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: php SSL Problem

From: Kevin Lowe <klowe_at_solomon.ie>
Date: Thu, 10 Jul 2003 10:00:44 +0100

MensajeHi,

Did you generate the private key and set the password yourself, or did someone give you them? If so, maybe you mave the wrong password, or maybe the key is not in a valid PEM format. It may be useful to use some openssl command line tools to verify the key before trying to get it to work with curl/php, then try it with the curl command line and finnaly with php.

Also, on the permissions note, the directory thet the key is in needs to be readalbe too, but i'm sure you checket that. I see that you seem to be storing the keys in the apache doc root tree, I would store them in a directory that apache cant serve from to prevent disclosure of your keys.

Kevin
  ----- Original Message -----
  From: josejuan
  To: curl-and-php_at_lists.sourceforge.net
  Sent: Wednesday, July 09, 2003 4:35 PM
  Subject: php SSL Problem

  Hello,
   
  Please we need some help in programming curl in PHP. We have this code:
   
  <?
  $ch = curl_init();
  $fp = fopen("php_homepage.txt", "w");
   
  curl_setopt($ch, CURLOPT_URL, "https://ssl.XXXX.com/WebService");
  curl_setopt($ch, CURLOPT_SSLVERSION, 3);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
  curl_setopt($ch, CURLOPT_SSLCERT, '/var/www/html/XXXXX/file02pub.pem');
  curl_setopt($ch, CURLOPT_SSLCERTPASSWD, '????????');
  //curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
  curl_setopt($ch, CURLOPT_SSLKEY, '/var/www/html/XXXXX/file02priv.pem');
  curl_setopt($ch, CURLOPT_FILE, $fp);
   
  ob_start();
  curl_exec($ch);
  ob_end_flush();
   
  if(curl_error($ch)) {
   printf("Se ha producido un error: [%s] %s", curl_errno($ch), curl_error($ch));
  }
   
  curl_close($ch);
  fclose($fp);
   
  ?>
   
  The result of this page is always the same:
   
  error: [58] unable to set private key file: '/var/www/html/XXXXX/file02priv.pem' type PEM
   
  What's the problem?
   
  Thank's in advance
   
   

-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
Received on 2003-07-10