我从电子支付商那个取得一个p12证书文档,我必须要将这个证书文档载入火狐才能正确的获取https的wdsl文件。以下是我把文档载入火狐的步骤:
步骤1:步骤2:步骤3:步骤4:步骤5:那么现在我想使用phpcurl来模拟火狐去截取https的wdsl文档,以下是我尝试过的代码,可是都是错误的,请大家指教:个案1:Unable to load client cert -8018.
$client = curl_init();
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($client, CURLOPT_URL, $address);
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
curl_setopt($client, CURLOPT_TIMEOUT, 150);
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
curl_setopt($client, CURLOPT_POST, true );
curl_setopt($client, CURLOPT_VERBOSE, true ); 
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($client, CURLOPT_SSLCERT, getcwd().'/latest_key/willaniclienttest.p12');//willaniclienttest.p12
curl_setopt($client, CURLOPT_SSLCERTTYPE, 'P12');
curl_setopt($client, CURLOPT_SSLCERTPASSWD, 'willanitest');个案2:Unable to load client cert -8018.$client = curl_init();
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($client, CURLOPT_URL, $address);
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
curl_setopt($client, CURLOPT_TIMEOUT, 150);
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
curl_setopt($client, CURLOPT_POST, true );
curl_setopt($client, CURLOPT_VERBOSE, true ); 
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($client, CURLOPT_CAINFO, getcwd().'/latest_key/cacert.pem'); // cacert.pem
curl_setopt($client, CURLOPT_SSLCERT, getcwd().'/latest_key/willaniclienttest.p12');//willaniclienttest.p12
curl_setopt($client, CURLOPT_SSLCERTTYPE, 'P12');
curl_setopt($client, CURLOPT_SSLCERTPASSWD, 'willanitest');到此,我尝试使用openssl指令把证书和密钥抽取出来
openssl pkcs12 -in yourP12File.pfx -nocerts -out privateKey.pem
openssl pkcs12 -in yourP12File.pfx -clcerts -nokeys -out publicCert.pem
个案3:Peer certificate cannot be authenticated with known CA certificates$client = curl_init();
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($client, CURLOPT_URL, $address);
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
curl_setopt($client, CURLOPT_TIMEOUT, 150);
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
curl_setopt($client, CURLOPT_POST, true );
curl_setopt($client, CURLOPT_VERBOSE, true ); 
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($client, CURLOPT_CAINFO, getcwd().'/latest_key/cacert.pem'); // cacert.pem
curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/latest_key/publicCert.pem'); //
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, "epay123");
curl_setopt($ch, CURLOPT_SSLKEY, getcwd().'/latest_key/privateKey.pem');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "epay123");个案4:NSS: client certificate not found (nickname not specified)$client = curl_init();
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($client, CURLOPT_URL, $address);
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
curl_setopt($client, CURLOPT_TIMEOUT, 150);
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
curl_setopt($client, CURLOPT_POST, true );
curl_setopt($client, CURLOPT_VERBOSE, true ); 
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/latest_key/publicCert.pem'); //
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, "epay123");
curl_setopt($ch, CURLOPT_SSLKEY, getcwd().'/latest_key/privateKey.pem');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "epay123");