There appears to be an issue with using client certificates. It works just fine from the command line as shown above, but trying to translate this into php is horrid. So far my code looks l ike this: // $clientcert contains a path to the client certificate file $certtext = file_get_contents($clientcert); print "

$certtext

"; $header = Array(); $header[] = "Content-Type: multipart/related \r\n"; $header[] = "type=text/xml \r\n"; $header[] = "boundary=--someBoundaryValue-- \r\n"; $header[] = "start=ebXML_Message_Header \r\n"; $header[] = $iptest; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_SSLCERT, $certtext); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $challenge); curl_setopt($ch, CURLOPT_SSLKEY, $clientkey); $ret = curl_exec ($ch); echo $ret; if ($ret == NULL) { echo "Error:
"; echo curl_errno($ch)." - ".curl_error($ch)."
"; } curl_close ($ch); I have tried different values for $clientkey. I have tried just pointing it at the certificate file and I have even tried cut-n-pasting the RSA PRIVATE KEY section from the certificate and using that, but whatever happens, I get this error: 58 - unable to use client certificate (no key found or wrong pass phrase?) which is the error returned by the command-line curl when the passphrase is wrong. What on earth is going on here?