duanjizi9443 2017-11-13 14:19
浏览 2116

卷曲错误:错误:14094418:SSL例程:ssl3_read_bytes:tlsv1 alert unknown ca

I'm working on a payment system integration for a website. For now I'm testing on a local computer with xampp. I have submitted a .csr file to the bank server, then they provide me the .crt file. I do have a .key file too.

When I try to submit the certificate and some value to the bank server with including certificate file path (.crt) and .key file, it throws the error:

Curl Error : error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca

My code is:

 $twpg_gateway_url = '<bankurl>';
    $twpg_cert_file = getcwd().'<.crtfile with path>'; 
    $twpg_key_file = getcwd().'<.keyfile with path>';
    $twpg_key_password = '';
    $curl = curl_init();

    $options = array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_POST => true,
        CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
        //CURLOPT_VERBOSE        => true,
        CURLOPT_URL => $twpg_gateway_url . '/Exec',
        CURLOPT_POSTFIELDS => $request,
        CURLOPT_HTTPHEADER => array('Content-Type: text/xml'),
        CURLOPT_TIMEOUT => 30
    );

    if ($twpg_cert_file != '') {
        $options[CURLOPT_SSLCERT] = $twpg_cert_file;
        $options[CURLOPT_SSLKEY] = $twpg_key_file;
        $options[CURLOPT_SSLKEYPASSWD] = $twpg_key_password;
    }

    curl_setopt_array($curl, $options);

    $response = curl_exec($curl);
    if(!$response)
    {
        echo "Curl Error : " . curl_error($curl);
    }
    curl_close($curl);

    return $response;
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog